Union-Find
Merge groups in near-constant time, then ask who belongs together.
Union-Find progress0 / 4
- Disjoint Sets BasicsEvery group is named by one root, and find walks up to it.5m
- Path CompressionYou already walked to the root — leave everyone pointing straight at it.5m
- Union by Rank or SizeHang the smaller tree under the bigger one and depth barely grows.5m
- Components & CyclesStart the counter at n and drop it on every union that actually merges.5m
Quiz yourself: 3 questions from this module
1 / 3