Delete the new maximum element and adjust the heap
Solved Step by step with explanation of Heap Deletion: Array Representation
Question
Consider the following list of integers: [910, 77, 66, 68, 1, 3, 11, 512, 89, 5] . Draw the max binary heap resulting from inserting the integers in the list in that order. What is the array representation of the heap after 2 calls to deleteMax?
Group of answer choices
Answer
Solved Step by step with explanation of Heap Deletion: Array Representation
To draw the max binary heap resulting from inserting the integers in the given list, we'll follow the process of inserting elements into a max heap:
Start with an empty heap.
Insert 77 into the heap and adjust: [910, 77]
Insert 66 into the heap and adjust: [910, 77, 66]
Insert 512 into the heap and adjust: [910, 77, 512, 68, 1, 3, 11, 66]
Insert 89 into the heap and adjust: [910, 77, 512, 68, 1, 3, 11, 66, 89]
Therefore, the array representation of the heap after 2 calls to deleteMax is [89, 77, 11, 68, 1, 3, 5, 66].
The correct answer is: [89, 77, 11, 68, 1, 3, 5, 66]