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

Function find_set

data_structures/disjoint_set/disjoint_set.py:42–48  ·  view source on GitHub ↗

Return the parent of x

(x: Node)

Source from the content-addressed store, hash-verified

40
41
42def find_set(x: Node) -> Node:
43 """
44 Return the parent of x
45 """
46 if x != x.parent:
47 x.parent = find_set(x.parent)
48 return x.parent
49
50
51def find_python_set(node: Node) -> set:

Callers 2

union_setFunction · 0.85
test_disjoint_setFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_disjoint_setFunction · 0.68