Guided lesson

DFS Concept

Graphs

DFS Concept

Practice pattern

Mental model

  • Can be recursive or stack-based.

Operations

visit

Cost shape

O(V + E)

Watch out

Stack overflow on deep graphs.

Related algorithms

DFSBacktracking
Guided progression
10% lesson
Step 1 / 2Learner goal
Speech settings Speed 1.0 · Volume 90%

Keyboard: Space play/pause · Arrow keys step · Page Up/Down change sections · R restart