Introduction
Union-Find (also called Disjoint Set Union or DSU) helps you track elements partitioned into non-overlapping sets. You can perform operations: find tells you which set an element belongs to, and union merges sets into one.
You'll use Union-Find in:
Kruskal's MST: Check if adding an edge creates a cycle
Cycle detection: Determine if a graph has cycles
Connected components: Group nodes that can reach each other
The key insight is representing sets as trees. Each element points to a parent, and the root identifies the set.