Tag: BFS
4 posts
-
C++ stack, queue and priority_queue: How the Adapters Work and the Mistakes They Invite
std::stack, std::queue and std::priority_queue explained: why pop() returns void, choosing the underlying container, min-heaps and custom comparators, Dijkstra, BFS bugs, and thread safety.
-
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.
-
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.