⚡ AlgoZen_
~/home/graphs/depth-first_search2 / 3

Depth-First Search

Intermediate

Explore a graph by going as deep as possible along each branch before backtracking. Uses a stack (or recursion) to track the path.

time:O(V + E)
space:O(V)
⚡ +200_XP
step[1/18]
> Start
A
B
C
D
E
F
Start DFS from node A. We go as deep as possible before backtracking.

// tap NEXT STEP to walk through one step at a time