add algorithm assignment-union find