recategorized by
15,116 views
5 votes
5 votes

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?

  1. $14,13,8,12,10$
  2. $14,12,13,10,8$
  3. $14,13,12,8,10$
  4. $14,13,12,10,8$
recategorized by

2 Answers

5 votes
5 votes

max-heap deletion is always done at the root node.

  • first, we delete a root node and call heapify.
edited by
0 votes
0 votes

Initial array 25, 14, 16 13, 10, 8. 12
after first deletion array became : 16 ,14 , 12 , 13 , 10 , 8 and
after second deletion array became 14 , 13, 12, 8 , 10

So option C is correct.

Answer:

Related questions

2 votes
2 votes
4 answers
3
Arjun asked Apr 22, 2018
6,414 views
If $\text{Tree-1}$ and $\text{Tree-2}$ are the trees indicated below:Which traversals of $\text{Tree-1}$ and $\text{Tree-2}$, respectively, will produce the same sequence...
5 votes
5 votes
2 answers
4
Arjun asked Apr 22, 2018
8,564 views
Consider the following program{ int x=1; printf("%d",(*char(char*)&x)); }Assuming required header files are included and if the machine in which this program is executed ...