Question: 2. Consider the following pseudocode for a disjoint-set implementation: Make-Set Cx) rank ) 0 Find-Set(x) return Find-Set (pLx) return LinkCx, y if rank]rank[y] else if
2. Consider the following pseudocode for a disjoint-set implementation: Make-Set Cx) rank ) 0 Find-Set(x) return Find-Set (pLx) return LinkCx, y if rank]rank[y] else if rankx)rank y) rank[y]ran[y]1 Union (,y) Link (Find-Set (x), Find-Set(y)) Show the data structure that results and the answers returned by the Find-Set operations in the following program for i ? 1 to 16 Make-Set() for i ? 1 to 15 by 2 Union, ) for i1 to 13 by 4 UnionC, 2) UnionCi xs) Union(x11, x13) Union(x1, x10) Find-Set() Find-Set(g) 3. Repeat question 2, except that you use the following Find-Set routine instead. Find-Set(x) (p[r] ? Find-Set (p())) return return
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
