quick_union algorithm