You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defunion_set(x, y):
""" union two sets. set with bigger rank should be parent, so that the disjoint set tree will be more flat. """x, y=find_set(x), find_set(y)
ifx.rank>y.rank:
y.parent=xelse:
x.parent=yifx.rank==y.rank:
y.rank+=1
here need check if x==y
The text was updated successfully, but these errors were encountered:
https://github.com/TheAlgorithms/Python/blob/master/data_structures/disjoint_set/disjoint_set.py
here need check if x==y
The text was updated successfully, but these errors were encountered: