Weighted Quick Find Algorithm with path Compression