Step 1/0
Complexity
Best:O(V+E)
Average:O(V+E)
Worst:O(V+E)
Space:O(V)
Description
Explores as far as possible along each branch before backtracking. Uses a stack (or recursion) to track nodes to visit.
When to use
Cycle detection, topological sort, path finding, maze solving. Memory-efficient for deep graphs compared to BFS.