Add Weighted Quick-union algorithm