UnionFind algorithm with path compression for dynamic connectivity problem
union find test code
UnionFind