Professional Documents
Culture Documents
Csifinal 3
Csifinal 3
Index i: 1 2 3 4 5 6 7 8
A[i]: 20 18 16 4 10 3 5 3
1. (2 points) Draw the corresponding binary tree, and then give the sequence of keys in pre-
order, in-order and post-order traversals.
20
Draw the tree:
⇒
4 !o s }
1
20,18/43,10
6/3,5
'
pre-order traversal: ,
2. (2 points) Write the content of the array A after performing the deletion of the maximum
element (removeMax()).
Index i: 1 2 3 4 5 6 7
* 16
A[i]: 18 10 16 4 3 35
41135 's
3. (2 points) Write the content of the array A after performing the insertion of key 19 to the
original max-Heap A, which is given on the top of this page.
Index i: 1 2 3 4 5 6 7 8 9
A[i]: 2019 16 1810 3 5 3 4
20
if \l6 20
41 to 5 's it \l6
's
st ,
=) n'to 's
}
'
tent
COPYRIGHT MOUMTLAGAN
4