Disjoint Sets
Union-Find Data Structure
Two optimization strategies:
Path compression
Union by rank
Initially a set has one element and a rank of zero. If two sets are unioned and have the same rank, the resulting set's rank is one larger
Amortized Complexity
Algorithm | Average | Worst case |
---|---|---|
Space | ||
Find | ||
Union |