this is a paragraph from data structure book, by Narasimha Karumanchi (disjoint set ADT)
fast find implementation(quick find)
this method uses an array, where the array contains the set name for each element.
In this representation to perform union(a,b)[assuming that a, is in set i and b is in set j] we need to scan the complete array and change all i to j. this take O(n).
my question 1
if find operation takes O(1) then why scan complete array and change all i to j ,only two of them need to change , so how it is O(n)
============
(book 8.8 section)
using an array which stores the parent of each element instead of using root as its set name, solve union O(n)my 2. question
how does it solve issue using parent? And how both root and parent approaches gives us skew tree?