Foundations
Linear Structures
Hashing
Array and String Patterns
Recursion, Search, and Sorting
Problem Solving Patterns
Algorithm Searching
Sorting Algorithms
Array Algorithms
Grid Algorithms
Linear Structure Algorithms
Hashing Algorithms
Recursion and Backtracking
Greedy Algorithms
Tree and Heap Algorithms
Graph Algorithms
Dynamic Programming Algorithms
String Algorithms
Math Algorithms
Keyboard ready
Space plays. Arrow keys step. R restarts.
LAB DFS Concept Lab
Graphs
Concept shape
Practice pattern
Definition
Depth-first search explores one path deeply before backtracking.
Step 1 / 5
Concept shape
Graphs Practice pattern
DFS Concept
Welcome to the DFS Concept concept lab. Depth-first search explores one path deeply before backtracking. The must know points are: Can be recursive or stack-based. Useful for components and cycle checks. Backtracking is DFS with choices. The common operations are: visit, recurse, backtrack. The complexity shape is O(V + E). Watch out for these pitfalls: Stack overflow on deep graphs. Forgetting visited state. Related algorithms include DFS, Backtracking.
Concept details
Depth-first search explores one path deeply before backtracking.
Must know
- Can be recursive or stack-based.
- Useful for components and cycle checks.
- Backtracking is DFS with choices.
Complexity
O(V + E)
1.0x