Interview concept

What is depth-first search (DFS)?

Depth-first search explores one branch of a graph fully before backtracking, using recursion or an explicit stack. It suits path finding, cycle detection, and topological ordering.

Summary

Key takeaways

Depth-first search (DFS) - Interview Concepts - ExtraBrain is part of ExtraBrain's local-first Mac workflow for live interviews, meetings, transcription, provider control, and responsible AI use.

Page focus

Depth-first search explores one branch of a graph fully before backtracking, using recursion or an explicit stack. It suits path finding, cycle detection, and topological ordering.

Platform fact

ExtraBrain has 1 current public platform family, macOS, with support for 2 Mac CPU families: Apple Silicon and Intel.

Data-flow fact

ExtraBrain has 3 configurable data paths to review before sensitive work: local Parakeet transcription, local Gemma 4 where installed and compatible, and external providers you choose.

Interview concept

How it works

Recursive or stack-based

Implement DFS with recursion or an explicit stack plus a visited set to avoid revisiting nodes.

Uses

DFS supports cycle detection, connected components, topological sort, and exhaustive path search.

When to use it

Prefer DFS when you must explore full paths or structure, not the shortest one.

Interview concept

Responsible use

Use any live AI assistant only where interview, workplace, school, and platform rules allow it. Do not use generated answers to misrepresent your skills, experience, or authorship.

FAQ

Common questions.

Short answers for people and crawlers comparing ExtraBrain with other live AI assistants.

When should I use DFS?

Use DFS for exhaustive path exploration, cycle detection, connected components, and topological sorting.

What is the complexity of DFS?

DFS runs in O(V + E) time and O(V) space for the visited set and recursion or stack.