YUNOVA · Data Structures & Algorithms · Module 12: Advanced graphs
Disjoint set union (Union-Find)
Disjoint set union (Union-Find)
Key points
- DSU keeps elements in disjoint sets with find and union operations.
- Path compression and union by rank make operations nearly constant time.
- It is used for cycle detection and Kruskal's algorithm.