Disjoint Set Union (Union-Find)

A Disjoint Set Union (DSU), also known as Union-Find, is an abstract data structure that tracks a set of elements partitioned into non-overlapping subsets. It supports two primary operations: `find(x)` which determines the subset element 'x' belongs to, and `union(x, y)` which merges the subsets containing elements 'x' and 'y'. DSUs are commonly used for problems involving connectivity, such as finding connected components in a graph or detecting cycles.

Tags

7 connections Built by Tim Jones