add union-find Algorithm