added quick union algorithm