Skip to content

Commit 167970b

Browse files
committed
Added Basic UnionFind
1 parent 4520d84 commit 167970b

File tree

11 files changed

+91
-167
lines changed

11 files changed

+91
-167
lines changed

Graphs/UnionFind/DisjointSet/01_basic_disjointset.py renamed to Graphs/UnionFind/01_basic_disjointset.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ def find(self, a):
3232
a = self.root[a]
3333
return a
3434

35-
uu = UnionFind(10)
35+
uu = UnionFind(6)
3636

3737
print(uu.root)
3838
uu.union(0,1)
39-
uu.union(0,2)
40-
uu.union(1,3)
41-
uu.union(4,8)
42-
uu.union(5,6)
43-
uu.union(5,7)
39+
uu.union(4,5)
40+
uu.union(1,4)
41+
4442
print(uu.root)
45-
print([i for i in range(10)])
43+
#print([i for i in range(6)])

Graphs/UnionFind/DisjointSet/02_path_compression.py

Lines changed: 0 additions & 35 deletions
This file was deleted.

Graphs/UnionFind/DisjointSet/03_quickfind_disjoint.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

Graphs/UnionFind/DisjointSet/04_quickunion_disjoint.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

Graphs/UnionFind/DisjointSet/05_optimized_disjoint.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

Graphs/UnionFind/DisjointSet/README.md

Whitespace-only changes.
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)