woonie

disjoint sets

Oct 3rd, 2012
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.17 KB | None | 0 0
  1. Union-find Disjoint Sets
  2.  
  3. public UnionFind(int N){
  4.     parent = new int[N];
  5.     rank = new int[N]; //all 0
  6.     numSets = N;
  7.     for (int i = 0; i < N; i++){
  8.         parent[i] = i;
  9.     }
Advertisement
Add Comment
Please, Sign In to add comment