This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public WeightedQuickUnionFind{ | |
private int[] id; | |
private int[] sz; | |
private int[] height; // this is for union-by-height | |
private int count; // the number of connected components | |
private int[] maximum; // keep track of the maximum object in each connected component | |
public WeightedQuickUnionFind(int N){ | |
id = new int[N]; | |
sz = new int[N]; |