![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法-并查集
大大kc
今日事,今日毕
展开
-
leetcode323. Number of Connected Components in an Undirected Graph
解法一bfs/** * @Author RenXintao * @Date 9/8/17 */class UndirectedGraphNode { int label; ArrayList<UndirectedGraphNode> neighbors; UndirectedGraphNode(int x) { label = x; ne原创 2017-09-08 20:15:22 · 458 阅读 · 0 评论 -
leetcode03. Find the Weak Connected Component in the Directed Graph
解法UnionFind/** * @Author RenXintao * @Date 9/20/17 * @method: UnionFind */ class UnionFind { HashMap<Integer, Integer> father = new HashMap<>(); UnionFind(HashSet<Integer> hashSet) {原创 2017-09-20 22:01:09 · 419 阅读 · 0 评论 -
leetcode200. Number of Islands
200. Number of IslandsGiven a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or verti原创 2017-09-29 21:25:41 · 313 阅读 · 0 评论