Disjoint Set
Sometime you may call Disjoint Set as Union-Find Set.
A disjoint-set data structurtre maintains a collection of disjoint dynamic sets. We identify each set by a representative member.
We can perform the following operations on a disjoint-set data structure:
- MakeSet(x): Create a new set containing only .
- Union(x, y): Combine the dynamic sets containing and into a new set that is the union of these two sets.
- Find(x): Return the representative member of the set containing .
using the linked-list representation of a disjoint-set data structure, we have amortized time complexity of for operations and make-set operations.
using the union-by-rank and path compression heuristics, we have amortized time complexity of for operations and make-set operations, where is the inverse Ackermann function, and like