Back to DashboardUpgrade
Pro pattern
Upgrade to Pro to access this pattern and all 22 patterns.
PATTERN
Union-Find
Use the Disjoint Set Union (DSU) structure to efficiently group elements, detect cycles in undirected graphs, and count connected components. Master path compression and union by rank for near-constant-time operations.
Learn Union-FindExplanation, templates & reference