Procházet zdrojové kódy

correction union find

Olivier Marty před 8 roky
rodič
revize
6829cbeb92
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  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); }