Mc190401514 Name: Imran kashif
Solution of assignment No. 3 CS301
Solution: (a)
3
4
6 16 19 24
8 11 20 23 30
The above diagram is min heap because each parent node is less than child node.
Solution: (b)
Step 1:
Data 2 3 4 6 16 19 24 8 11 20 23 30 1
Array 0 1 2 3 4 5 6 7 8 9 10 11 12 13
index
3
4
6 16 19 24
8 11 20 23 30 1
Step 2:
Data 2 3 4 6 16 1 24 8 11 20 23 30 19
Array 0 1 2 3 4 5 6 7 8 9 10 11 12 13
index
3
4
6 16 1 24
8 11 20 23 30 19
Step 3:
Data 2 3 1 6 16 4 24 8 11 20 23 30 19
Array 0 1 2 3 4 5 6 7 8 9 10 11 12 13
index
3
1
6 16 4 24
8 11 20 23 30 19
Step 4:
Data 1 3 2 6 16 4 24 8 11 20 23 30 19
Array 0 1 2 3 4 5 6 7 8 9 10 11 12 13
index
3
2
6 16 4 24
8 11 20 23 30 19
The above diagram is min heap because each parent node is less than child node.
**********************************************************************************