单选题:The array representation of the disjoint sets is given by S[] wi
The array representation of the disjoint sets is given by S[] with S[i] being initialized to be -1 for all i. Please list the resulting array elements after invoking: union(1,2), union(3,4), union(3,5), union(1,7), union(3,6), union(8,9), union(1,8), union(1,3), and union(9,10). Assume that union-by-size and find-with-path-compression, and the elements are numbered from 1 to 10.
A.{-9, 1, 1, 3, 3, 3, 1, 1, 8, –1}
B.{-3, 1, -4, 3, 3, 3, 1, -2, 8, –1}
C.{-10, 1, 1, 3, 3, 3, 1, 1, 1, 1}
D.{-9, 1, 1, 3, 3, 3, 1, 1, 1, 1}
答案:C
A.{-9, 1, 1, 3, 3, 3, 1, 1, 8, –1}
B.{-3, 1, -4, 3, 3, 3, 1, -2, 8, –1}
C.{-10, 1, 1, 3, 3, 3, 1, 1, 1, 1}
D.{-9, 1, 1, 3, 3, 3, 1, 1, 1, 1}
答案:C