This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Finally, for each of these (nal) trees, perform a nd with path compression on the deepest node, and show the resulting tree. 3. (10 pts) Suppose we start with n singleton nodes, and perform an arbitrary sequence of unions using the union by height rulethat is, always make the shallower tree the child. Then, give a proof (reasoning) that the worst-case depth of any tree is O (log n ). 4. (10 pts) Give a proof for the following assertion: if all of the unions precede all the nds, then the disjoint set algorithm with path compression requires O ( n ) time, even if unions are done arbitrarily....
View Full Document
- Winter '11