8.10 (a) When we perform a union we push onto a stack the two roots and the old values of their parents. To
implement a deunion, we only have to pop the stack and restore the values. This strategy works fine in the
8.11 We assume that the tree is implemented with links instead of a simple array. Thus find will return a reference
instead of an actual set name. We will keep an array to map set numbers to their tree nodes. union and find
are implemented in the standard manner. To perform remove(x), first perform a find(x) with path
compression. Then mark the node containing x as vacant. Create a new one-node tree with x and have it
8.12 Suppose there are u union and f find operations. Each union costs constant time, for a total of u. A find costs
one unit per vertex visited. We charge, as in the text, under the following slightly modified rules:
(A) the vertex is a root or child of the root