Added path-compression version of UnionFind.