Tag: DFS
4 posts
-
Graph Representation: Adjacency List vs Matrix, Building Graphs from Input, and Cycle Detection
Graph representation for interviews: adjacency list vs matrix memory, grids and edge lists, index bugs in graph building, cycle detection, topological sort.
-
BFS vs DFS: Choosing a Graph Traversal for Shortest Paths, Components and Cycles
BFS and DFS in Python for interviews: why BFS finds shortest paths, when to mark nodes visited, recursion limits, iterative DFS order bugs and grid patterns.
-
Backtracking: Pruning the Search Tree for Permutations, N-Queens and Sudoku
How backtracking prunes a search tree, why you undo instead of copy, and how pruning order and constraint checks decide whether permutations, N-Queens, and Sudoku finish in milliseconds or never.
-
BFS vs DFS: How Each Works, Complexity and Which to Use for Which Problem
Compare BFS and DFS from the perspective of working principles, time complexity, and space complexity.