Union-Find (Disjoint Set)
Visualize how the Union-Find data structure efficiently tracks and merges disjoint sets.
Free theory articleVisualize how the Union-Find data structure efficiently tracks and merges disjoint sets.
Concept & interpretation
The Union-Find data structure, also known as a disjoint-set data structure, is a powerful tool used to keep track of a set of elements partitioned into a number of disjoint (non-overlapping) subsets. It provides near-constant-time operations to add new sets, to merge existing sets, and to determine whether elements are in the same set. This makes it incredibly efficient for tasks such as finding connected components in a network or cycle detection in graphs.