what is the output for the above program? (first time posting a question) Consid
ID: 3743087 • Letter: W
Question
what is the output for the above program? (first time posting a question)
Consider the following program 1, for i from 1 to 12: MakeSet ( ) 3 Union(2, 10) 4 Union(7, 5) 5 Union(6, 1) 6 Union(3, 4) 7 Union(5, 11) 8 Union(7, 8) 9 Union(7, 3) 10 Union (12, 2) 11 Union(9, 6) 12 print (Find (6)) 13 print(Find(3)) 14 print(Find (11)) 15 print(Find(9)) Assume that the disjoint sets data structure is implemented as an array smallest[1.. .12 smallesti is equal to the smallest element in the set containing iExplanation / Answer
The output of the following program is in order :
print(find(6)) - 1
print(find(3)) - 4
print(find(11)) -11
print(find(9)) - 6
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.