題目
797 All Paths From Source to Target (Medium)
133 Clone Graph (Medium)
207 Course Schedule (Medium)
210 Course Schedule II (Medium)
785 Is Graph Bipartite? (Medium)
886 Possible Bipartition (Medium)
Union-Find
- 323 Number of Connected Components in an Undirected Graph (Medium, Premium)
- 547 Number of Provinces (Medium)
- 130 Surrounded Regions (Medium)
- 990 Satisfiability of Equality Equations (Medium)
Kruskal
- 261 Graph Valid Tree (Medium, Premium)
- 1135 Connecting Cities With Minimum Cost (Medium, Premium)
- 1584 Min Cost to Connect All Points (Medium)
Dijstrka
743 Network Delay Time (Medium)
1514 Path with Maximum Probability (Medium)
1631 Path With Minimum Effort (Medium)
277 Find the Celebrity (Medium, Premium)
補充
787 Cheapest Flights Within K Stops (Medium)
847 Shortest Path Visiting All Nodes (Hard)
觀念
多個子樹的樹 - 圖的前身
1 | /* 多叉树遍历框架 */ |
圖
圖可能會有環,所以需要另外空間去紀錄拜訪過的點
1 | // 有環的圖 |