Depth-first search
Lesson 16 of 20 · Algo.Micro
Go as deep as possible, back up at dead ends: backtracking.
DFS always moves to the first unvisited neighbour (right, down, left, up). The highlighted trail is the current path from S.
Check yourself
What does DFS do at a dead end?
Do it in the browser: a real algorithms tool, a short mission and instant feedback. No install.
Start this lesson — free