Depth First Search
Depth-first search follows one neighbor as far as it can, then backtracks. With an adjacency list it looks at each vertex and each edge a constant number of times.
Costs
| Category | Algorithm |
| Difficulty | Medium |
| Time, adjacency list | O(V + E) |
| Time, adjacency matrix | O(V²) |
| Stack | O(V) |
Questions
What is Depth First Search?
Depth-first search follows one neighbor as far as it can, then backtracks. With an adjacency list it looks at each vertex and each edge a constant number of times.
Where do I practice it?
DSA Master keeps challenges and progress on the phone. This page is the idea and the costs.