completed coding of quick union weighted