Union-find analysis [00PE]

How long do these operations take? Clearly \mathsf {Union} takes T_{\mathsf {Find}} + \Theta (1). So implementing \mathsf {Find} efficiently is the crux of the issue. It seems like it might take \Theta (n) in the worst case, if we end up with an unbalanced tree—for example, if all the items in a tree end up in a long linear chain. But it turns out that being careful in how we implement \mathsf {Union}, taking heights into account, means this will never happen! The following theorem tells us something about what the resulting trees can look like.

Context

Union-find design and analysis [00PD]