Study Notes | disjoint-set

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.
Published 143 original articles · won praise 22 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_34170700/article/details/104281159