Question: Consider the following procedure Foo ( n ) , where the operations Make - Set ( x ) , Find - Set ( x )
Consider the following procedure Foon where the operations MakeSetx FindSetx and Union x y are implemented using disjointset forest with union by rank as discussed in class.
Foon
for i to n
MakeSeti
for i to n
Unioni i n
for j n downto n
if FindSetj FindSetj
Unionj j
Perform Foo
How many trees will be generated after executing the second for loop lines &
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
