CSC300 / CSC402: Comparing UF implementations [9/9] Previous pageContents

Suppose that we have three elements [0, 1, 2] and that we union 0 and 1, and then 1 and 2.

When we union 0 and 1, let's suppose that 1 is the champion, so the array is [1, 1, 2]. Pictorially, we have:

uf112

What can happen after we union 1 and 2?

Previous pageContents