Skip to content

Glossary: Algorithms Beyond the Basics in C++

Union-find

Also written: disjoint set union, DSU, union_

Also called disjoint set union: a structure that keeps items in groups and answers 'same group?' almost instantly, with `find` to get a group's root and `union` to join two groups. Sam uses it to track pooled café orders.

Where the book teaches it

Related terms

union by sizeconnected component