C++ UnionFind BFS DFS解圖論問題Leetcode 1971 Find if Path Exists in Graph
使用UnionFind class實作容易,效能又好,這對無向圖特別有效。
-----
Using UnionFind class is easy to implement and performs well. This is especially effective for undirected graphs.
For comparison, BFS and DFS are also implemented.
[codes on Leetcode]https://leetcode.com/problems/find-if-path-exists-in-graph/solutions/5052126/union-find-is-good-vs-dfs-vs-bfs-193ms-beats-99-93/
[Tree & Graph Playlist]https://www.youtube.com/watch?v=9Lx7yr-tmfI&list=PLYRlUBnWnd5Kt0-3un43cwY6yT_il8NWe
沒有留言:
張貼留言