-->
当前位置:首页 > 题库 > 正文内容

单选题:The array representation of the disjoint sets is given by S[] wi

Luz4年前 (2022-01-18)题库801
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

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。