MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / make_set

Function make_set

data_structures/disjoint_set/disjoint_set.py:14–21  ·  view source on GitHub ↗

Make x as a set.

(x: Node)

Source from the content-addressed store, hash-verified

12
13
14def make_set(x: Node) -> None:
15 """
16 Make x as a set.
17 """
18 # rank is the distance from x to its' parent
19 # root's rank is 0
20 x.rank = 0
21 x.parent = x
22
23
24def union_set(x: Node, y: Node) -> None:

Callers 1

test_disjoint_setFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_disjoint_setFunction · 0.68