javascript-algorithms/src/data-structures/disjoint-set
2018-05-04 06:18:05 +03:00
..
__test__ Add disjoint set. 2018-05-04 06:18:05 +03:00
DisjointSet.js Add disjoint set. 2018-05-04 06:18:05 +03:00
DisjointSetItem.js Add disjoint set. 2018-05-04 06:18:05 +03:00
README.md Add disjoint set. 2018-05-03 16:49:46 +03:00

Disjoint Set

Disjoint-set data structure (also called a unionfind data structure or mergefind set) is a data structure that tracks a set of elements partitioned into a number of disjoint (non-overlapping) subsets. It provides near-constant-time operations (bounded by the inverse Ackermann function) to add new sets, to merge existing sets, and to determine whether elements are in the same set. In addition to many other uses (see the Applications section), disjoint-sets play a key role in Kruskal's algorithm for finding the minimum spanning tree of a graph.

disjoint set

MakeSet creates 8 singletons.

disjoint set

After some operations of Union, some sets are grouped together.

References