Interface
Implementation of the Disjoint-Set Union (DSU), also called Union-Find.
-
class SetNode(data: int, parent: int = -1)
The atomic element of the class UnionFind.
-
__init__(data: int, parent: int = -1) → None
-
property data: int
-
class UnionFind
Implementation of DSU with list.
-
__init__() → None
Initialize the UnionFind.
-
insert(node: SetNode) → None
-
find(item: int) → int
-
union(x: int, y: int) → None