Question: (c) Given the following array for the tree representation of UnionFind sets: index D J K treeParent[] B K A B C C C

(c) Given the following array for the tree representation of UnionFind sets: index D J K treeParent[] B K A B

(c) Given the following array for the tree representation of UnionFind sets: index D J K treeParent[] B K A B C C C C E D F G H F D K | H i) draw the corresponding trees. ii) what do the operations set1 = findSet(G) and set2 = findSet(H) return? Briefly comment on how you arrived at the answer. iii) draw the resulting tree from the operation union(set1, set2) where set1 and set2 are from part ii). iv) Suppose you had implemented findSet() with tree-compression, show the effect findSet(E) would have on the corresponding set-tree. Also show the updated treeParent[] array.

Step by Step Solution

3.39 Rating (171 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!