Union-Find
Keep track of which items belong together as links arrive, in almost constant time. Parent pointers, union by size, path halving, and why it beats searching again after every link.
Spotted a mistake in this lesson?Report an issue →
Keep track of which items belong together as links arrive, in almost constant time. Parent pointers, union by size, path halving, and why it beats searching again after every link.