Given a binary-max heap. The elements are stored in an arrays as 25, 14, 16, 13, 10, 8, 12.What is the content of the array after two delete operations?

Given a binary-max heap. The elements are stored in an arrays as 25, 14, 16, 13, 10, 8, 12.What is the content of the array after two delete operations? Correct Answer 14, 13, 12, 8, 10 

Key Points

In a binary max-heap deletion is always done at the root.

STEPS:

  1. Delete the root node.
  2. Replace it with the rightmost leaf node and call heapify( ) procedure again. 

Max heap: Deletion

[ alt="F1 Shraddha Raju 22.02.2021 D1" src="//storage.googleapis.com/tb-img/production/21/02/F1_Shraddha_Raju_22.02.2021_D1.png" style="width: 458px; height: 556px;">

Heap elements: 14,13,12,8,10,

Therefore the correct answer is option 3.

Related Questions

A teacher asked the class to subtract 5 from 75.70% of the class said: 25. Their work was shown as: \(\begin{array}{*{20}{c}} {\begin{array}{*{20}{c}} 7&5 \end{array}}\\ {\underline {\begin{array}{*{20}{c}}\ { - 5} \ \ \ &{} \end{array}} }\\ {\underline {\begin{array}{*{20}{c}} 2&5 \end{array}} } \end{array}\) Which of the following describes the most appropriate remedial action that the teacher should take to clarify this misconception?