Disjoint Set (Union-Find): Easy to Hard Problems
Easy
- Number of Provinces (Finds the number of connected components in a graph using Union-Find)
- Find the Redundant Connection (Finds an edge that creates a cycle in a graph, using Union-Find)
- Graph Valid Tree (Determines if a graph is a valid tree using Union-Find)
- Connections Between Cities (Basic union-find problem for connecting cities)
- Number of Connected Components in an Undirected Graph (Counts connected components in an undirected graph using Union-Find)
Medium
- Redundant Connection II (Finds the redundant edge in a graph with exactly one cycle, using Union-Find)
- Shortest Path with Alternating Colors (Involves Union-Find for handling color constraints in paths)
- Number of Islands II (Counts islands after multiple additions, using Union-Find)
- Dynamic Connectivity (Advanced problem involving dynamic connectivity with Union-Find)
- Critical Connections in a Network (Finds critical edges that, if removed, would increase the number of connected components)
Hard
- Largest Component Size by Common Factor (Finds the largest component size in a graph with common factors, using Union-Find)
- Minimum Cost to Connect All Points (Finds the minimum cost to connect all points in a plane using MST with Union-Find)
- Optimal Network Design (Designs an optimal network with Union-Find for large constraints)
- Redundant Connection III (Handles multiple redundant connections in a graph using Union-Find)
- Union-Find with Path Compression and Union by Rank (Advanced Union-Find implementation problem)