#bfs
7 articles
Graphs: Everything Is Connected
Graphs model maps, social networks, and dependencies. Learn how nodes and edges work, how to represent them, and what BFS and DFS unlock.
Queues and Deques
The queue data structure enforces first in, first out — powering BFS and schedulers. Learn why list.pop(0) costs O(n) and how to get true O(1).
Graphs
Learn the graph data structure: adjacency lists vs matrices, BFS and DFS traversal, and the grid-as-graph reframe that cracks whole problem categories.
Binary Trees and Traversals
Master binary tree traversal — inorder, preorder, postorder, and level-order — and the recursive mindset that makes dozens of tree problems click instantly.
Topological Sort
Order the nodes of a DAG so every edge points forward — the algorithm that drives build systems, package managers, course schedulers, and anything else that lives and dies by dependency ordering.
Shortest Paths (Dijkstra, Bellman-Ford, BFS)
Pick the right shortest-path algorithm: BFS for unweighted graphs, Dijkstra for non-negative weights, Bellman-Ford for negative edges — with every gotcha.
BFS Patterns
Queue-driven level-by-level traversal and why breadth-first search is the only guaranteed way to find shortest paths in unweighted graphs. Templates, traps, and four worked problems.