Improving the weighted quick union algorithm with path compression.