Tag: Union-Find

  •  The Earliest Moment When Everyone Become Friends

    Problem https://leetcode.com/problems/the-earliest-moment-when-everyone-become-friends/description/ Solution Notes How to sort 2D array in ascending order How to sort 2D array in descending order

  • Redundant Connection

    Problem https://leetcode.com/problems/redundant-connection/ Solution #1. DFS Solution #2. Union Find

  • Number of Connected Components in an Undirected Graph

    Problem https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/ Solution #1. DFS Solution #2. Union Find

  • Graph Valid Tree

    Problem https://leetcode.com/problems/graph-valid-tree/description/ Solution #1. DFS Solution #2. Union-Find Solution #3. Union-Find with boolean type

  • Number of Provinces

    Problem https://leetcode.com/explore/featured/card/graph/618/disjoint-set/3845/ Solution

  • Disjoint Set (Union-Find)

    What is Disjoint Set ? Idea of Union-Find #1. Parent Vertex를 저장하는 배열을 만든다. #2. 각 Edge 를 돌면서 parent vertex를 업데이트한다. (Union) #3. Connectivity 확인 (Find) Quick Find – Improved Idea of Union-Find #1 위에서 서술한 방법에서 조금만 개선하면 더 나은 알고리즘이 될 수 있다. parent vertex 배열을 root…