Skip to content

Commit 30e8f1e

Browse files
authored
Merge pull request #79 from tiationg-kho/update
update
2 parents ba2dd0d + 999a98b commit 30e8f1e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

[K]graph/graph.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ class UnionFind:
116116
self.parent[p] = self.parent[self.parent[p]]
117117
p = self.parent[p]
118118
return p
119+
120+
'''
121+
def find(self, p):
122+
if p != self.parent[p]:
123+
self.parent[p] = self.find(self.parent[p])
124+
return self.parent[p]
125+
'''
119126

120127
# union by rank
121128
def union(self, p, q):

0 commit comments

Comments
 (0)