Question: Thumb up for the solution, thx! 3) Heaps (10 marks) a) Initially, a max-heap has 6 elements. The level-order traversal of the heap is given

Thumb up for the solution, thx!
3) Heaps (10 marks) a) Initially, a max-heap has 6 elements. The level-order traversal of the heap is given by: 10, 8, 6, 5,3,2. The heap is stored in an array ALL.10) as follows. 23 4 5 67 89 10 10 8653 2 i. Draw the heap as a binary tree. ii. Two new elements '' and '7" are inserted in the heap in that order. Show the heap as a binary tree after the insertion of the two elements b) The level-order traversal of a complete binary tree is as follows: 1,4,3,14,16,9,10. Show the steps to build a max-heap out of the binary tree by drawing the tree after each call of the function max-heapify. c) We are given an array of 6 numbers in the following. We need to find the 3 largest numbers in the array, and a min-heap of size 3 is used for this purpose. The numbers are scanned in the order of 7,5,6,2,9,8. After each number is scanned it may be inserted into the heap if appropriate. Show the heap (as a binary tree) after each heap-extract-min operation and each heap-insert operation. In the end the heap should contain the required results
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
