add union find algorithms