Union-Find (Disjoint Set)
Tracks partition into sets with near-constant find/union. Core of Kruskal, image segmentation, and percolation. Parent pointers + path compression + union by rank.
Method
• Make set for each element. • Find root of x with path compression. • Union: attach smaller tree under larger. • Check same set by same root.
Limitations
The inverse-Ackermann bound is amortized for suitable union-by-rank/size with path compression, not each operation’s worst case or every implementation.
Example
Kruskal checks if an edge would form a cycle in almost O(1).
Editorial clarification
The inverse-Ackermann bound is amortized for suitable union-by-rank/size with path compression, not each operation’s worst case or every implementation.
Sources
Educational reference only, not professional advice.
All algorithms