Skip to content

Glossary: Algorithms Beyond the Basics in Rust

Union-find

Also written: disjoint set union, DSU

A structure that keeps items in groups, with `find` to get a group's root and `union` to join two groups, both nearly O(1). Sam uses it to see which cafés share a pool.

Where the book teaches it

Related terms

Path compressionUnion by sizeRoot (union-find)Kruskal's algorithmConnected component