Skip to content

Commit

Permalink
Update redundant-connection.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Sep 24, 2017
1 parent d50076b commit ec9ed86
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Python/redundant-connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ def __init__(self, n):
self.count = n

def find_set(self, x):
if self.set[x] != x:
self.set[x] = self.find_set(self.set[x]) # path compression.
return self.set[x]
if self.set[x] != x:
self.set[x] = self.find_set(self.set[x]) # path compression.
return self.set[x]

def union_set(self, x, y):
x_root, y_root = map(self.find_set, (x, y))
Expand Down

0 comments on commit ec9ed86

Please sign in to comment.