Professional Documents
Culture Documents
Cs502 2 Assignment MC180203227
Cs502 2 Assignment MC180203227
MC180203227
Question No.1
a) Draw the final Min-Heap structure for the following array; show the final result (tree) only.
5 7
25 13 19 12
5
30 27 26
b) Draw the final Max-Heap structure for the following array; show the final result (tree) only.
Solution:
30
27 19
5
25 26 5 12
5
1 13 7
Question No. 02
You are given an array; you have to apply partition algorithm of quick sort on this array.
You are required to show all the steps of partition algorithm.
9 1 7 20 12 18 2 15 4 17
p r
9 1 7 20 12 18 2 15 4 17
q s
Solution: