Graphs
Patterns to know:
- BFS/DFS traversal.
- Union-Find (connected components, cycle detection).
- Topological Sort (Kahn’s algorithm or DFS).
- Dijkstra / Bellman-Ford / A*.
How to identify:
- Input: nodes + edges or 2D grid.
- “Number of islands / connected components” → DFS/BFS.
- “Prerequisites / ordering” → topological sort.
- Weighted shortest path → Dijkstra.