Add weighted quick union algorithm