Disjoint Set (Union-Find) data structure
A disjoint-set data structure (also called union-find) keeps track of a set of elements
partitioned into a number of disjoint (non-overlapping) subsets.
It supports two operations: union (join two subsets) and find (determine which subset an element is in).
Disjoint Set (Union-Find) data structure A disjoint-set data structure (also called union-find) keeps track of a set of elements partitioned into a number of disjoint (non-overlapping) subsets. It supports two operations: union (join two subsets) and find (determine which subset an element is in).
Example