AI engineering glossary · Data structures algorithms
What is DSU (union-find)?
Union-find (also called disjoint set union, DSU): A structure that tracks a partition of items into groups and supports two operations: find which group an item belongs to, and union two groups. With path compression and union by rank, each operation takes almost constant time.
Union-find: an example
Grouping friends into circles: after union(Ravi, Meena) and union(Meena, Sana), find gives the same group for Ravi and Sana.
Related terms
More Data structures algorithms terms
- Weighted graph
- Worst-case analysis
- A* search
- Abstract data type
- Adjacency list
- Adjacency matrix
- Algorithm
- Amortized analysis
Where you learn it
Union-find is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.