Improving Efficiency of WeightedQuickUnion using path compression