Path compression for weighted quick union