Skip to content

Glossary: Algorithms Beyond the Basics in Go

Union-find

Also written: disjoint set union, DSU

A structure that keeps items in groups, with `find` to get an item's root and `union` to join two groups. With both tricks each call is nearly O(1).

Where the book teaches it

Related terms

Root (union-find)Path compressionUnion by sizeKruskal's algorithm