Path compression involves assigning the root as the new parent of every node on the path - this may reduce the rank of the root, and possibly the rank of all nodes on the path. Is there a way to deal with this? And is it necessary to deal with this? Or perhaps is it okay to think of rank as the upper bound of the height of the tree instead of the exact height?
Thanks!
Yes, you can think of the rank as being an upper bound on the height. Its purpose is to limit the lengths of paths to at most logarithmic, by enforcing the invariant that a tree with less than 2^k nodes has height less than k.