Disjoint-set
01 and check-defined set of
并查集
A data structure is a set of maintenance. Disjoint-set with an array implementation.
1⃣️ Merge Union
: merge two sets.
2⃣️ Find Find
: determine whether the two elements in a collection.
The same collection, there is only one root node.
02 and check the basic set of operations
1⃣️ initialization
Find 2⃣️
3⃣️ merger
The root of a collection of the father pointing to the root of another set.
Disjoint-set generated in each set is a tree.
03 compression path
application:
- Determining whether there is no hoop in FIG.