Initial check-in of UnionFind algorithm