Union-Find¶
A union-find
, is a data structure that stores a collection of disjoint(non-overlapping) setting. Equivalently, it stores a partition of a set into disjoint subsets. It provides operations for adding new sets, merging sets and finding a representative member of a set.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
Problems:
- satisfiability-of-equality-equations
- number-of-provinces
- redundant-connection
- number-of-operations-to-make-network-connected
- number-of-provinces
- evaluate-division
- regions-cut-by-slashes
- swim-in-rising-water
- smallest-string-with-swaps
- most-stones-removed-with-same-row-or-column
- bricks-falling-when-hit