add implementation for weigted quick union find algorithm