Union-Find (Disjoint Set)
Track connected components with union by rank + path compression. LC 200, 547, 684, 721.
Unioning
Finding root
Same component
Controls
Find: O(α(n)) ≈ O(1) | Union: O(α(n)) ≈ O(1)
Operations
0 stepsPress Run Random Unions to trace the algorithm one step at a time.