Loading Thita. Almost there...
Graph Traversal Patterns - DFS and BFS · 11 of 12
Find minimum spanning tree using Kruskal's or Prim's algorithm with Union-Find or heap.
Access the full theory, code examples, and practice problems.
Start LearningUse DFS to find connected components and count islands in grids. Flood fill and province counting problems.
Use BFS for shortest path in unweighted graphs. Solve word ladder, rotting oranges, and matrix problems.
Master topological sorting using Kahn's BFS algorithm. Solve course schedule and build order problems.
Detect cycles in directed graphs using DFS with coloring (white, gray, black) approach.