Browse Source

correction union find

Olivier Marty 8 years ago
parent
commit
6829cbeb92
1 changed files with 1 additions and 1 deletions
  1. 1 1
      code/UnionFind.cc

+ 1 - 1
code/UnionFind.cc

@@ -2,4 +2,4 @@
 // path compression but no balancing
 int make(int *C, int n) { for(int i = 0; i < n; i++) C[i]=i; }
 int find(int *C, int x) { return (C[x]==x) ? x : C[x]=find(C, C[x]); }
-void unite(int *C, int x, int y) { C[find(x)] = find(y); }
+void unite(int *C, int x, int y) { C[find(C, x)] = find(C, y); }