Question: Consider the elements 1..10 that will be used in a Disjoint Sets exercise. Using the Weighted Union and Collapsing Find heuristics, apply the following sequence

Consider the elements 1..10 that will be used in a Disjoint Sets exercise. Using the Weighted Union and Collapsing Find heuristics, apply the following sequence of operations, redrawing all the sets in tree representation after each operation. Remember that Find (i) returns a result but also might change the tree representation.

Note: For consistency, when calling Merge_trees (i,j) from within Union (i,j), if i and j are two trees of equal height, make Parent[i] = j (i.e. attach i under j).

- For i = 1 to 10do {makeset (i)}

- Union (6, 7) - Union (4, 10)

- Union (3, 1) - Union (2, 4)

- Union (1, 5) - Union (8, 2)

- Union (4, 6)

- Union (7, 1)

- Find (8)

Step by Step Solution

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 Databases Questions!