I need help understanding the explanations posed by weighted quick connect questions:
Which of the following arrays id[]could be the result of launching a weighted algorithm for fast combining on multiple elements 10? Check all that apply.Recall that our weighted quick join algorithm uses size aggregation (number of nodes) (rather than height aggregation).False: 9 1 7 3 4 9 6 7 8 9Explanation:9-5 7-2 5-0False: 2 2 2 2 5 1 2 3 1 2Explanation:2-9 3-7 9-3 5-4 0-2 1-8 8-4 4-9 8-6Correct: 9 9 3 4 9 4 9 9 4 2Explanation: the array id[]contains a loop:2->3->4->9->2Correct: 0 2 3 0 0 2 2 9 3 0Explanation: the size of the tree rooted in the parent is 2 <twice the size of the tree rooted in2Correct: 0 4 6 7 4 1 5 1 7 3Explanation: Forest height =4 > lg N = lg(10)
Which of the following arrays id[]could be the result of launching a weighted algorithm for fast combining on multiple elements 10? Check all that apply.
id[]
10
Recall that our weighted quick join algorithm uses size aggregation (number of nodes) (rather than height aggregation).
False: 9 1 7 3 4 9 6 7 8 9Explanation:9-5 7-2 5-0
9 1 7 3 4 9 6 7 8 9
9-5 7-2 5-0
False: 2 2 2 2 5 1 2 3 1 2Explanation:2-9 3-7 9-3 5-4 0-2 1-8 8-4 4-9 8-6
2 2 2 2 5 1 2 3 1 2
2-9 3-7 9-3 5-4 0-2 1-8 8-4 4-9 8-6
Correct: 9 9 3 4 9 4 9 9 4 2Explanation: the array id[]contains a loop:2->3->4->9->2
9 9 3 4 9 4 9 9 4 2
2->3->4->9->2
Correct: 0 2 3 0 0 2 2 9 3 0Explanation: the size of the tree rooted in the parent is 2 <twice the size of the tree rooted in2
0 2 3 0 0 2 2 9 3 0
2 <
2
Correct: 0 4 6 7 4 1 5 1 7 3Explanation: Forest height =4 > lg N = lg(10)
0 4 6 7 4 1 5 1 7 3
4 > lg N = lg(10)
, , .
, , ?
. . , . .
?
1. union , . ( SZ[]). (SZ[root(i)]).
union
SZ[]
SZ[root(i)]
. 1. 2 - A & B, A . max(A.height, B.height+1).
A & B
max(A.height, B.height+1)
, , ,
, node , node, , , , , .