Direction: Consider a binary max-heap implemented using an array :
-
What is the content of the array after two delete operations on the correct answer to the previous question?
-
- {14, 13, 12, 10, 8}
- {14, 12, 13, 8, 10}
- {14, 13, 8, 12, 10}
- {14, 13, 12, 8, 10}
- {14, 13, 12, 10, 8}
Correct Option: D
Always a greater element is deleted from the binary heap first. The answer of previous question gave the array as [25, 14, 16, 13, 10, 12, 8]
So, when the greatest element, i.e., 25 is deleted the array becomes [14, 16, 13, 10, 12, 8]
And next after second deletion the array becomes [14, 13, 10, 12, 8]
Thus, the procedure for the obtaining the final tree is as follows.