非森林版查集
并查集V1.1不使用联合启发式或路径压缩算法,新版本采用同样的基本思路,但使用了按等级和路径压缩的并集。
核心功能- void union(root1, root2) → Merge two sets
- int find(x) → Return set containing x
/**
* Disjoint set class, using union by rank and path compression.
* Elements in the set are numbered starting at 0.
*/
public class DisjSets {
private int [] set;
/**
* Construct the d