retagged by
211 views
0 votes
0 votes

A binary max-heap is implemented using an array $A$. The contents of $A$ is $\left \{90, 70, 75, 15, 45, 40, 60 \right \}$. The contents of $A\left[3 \right ]$ are increased from $15$ to $100$.

What will the contents of $A$ be after that change?

  1.     $\left \{ 90, 100, 75, 70, 45, 40, 60 \right \}$
  2.     $\left \{ 100, 90, 75, 70, 45, 40, 60 \right \}$
  3.     $\left \{ 100, 90, 75, 45, 70, 40, 60 \right \}$
  4.     $\left \{ 100, 90, 75, 70, 45, 60, 40 \right \}$
retagged by

1 Answer

Best answer
1 votes
1 votes

       90                             

/            \            

70           75   

/  \          /    \

15  45   40    60  

15 is increase to 100

       90                             

/            \            

70           75   

/  \          /    \

100  45   40    60   

|||

       90                             

/            \            

100           75   

/  \          /    \

70  45   40    60   

|||

100                            

/            \            

90           75   

/  \          /    \

70  45   40    60  

so revised array is {100,90,75,70,45,40,60}

             

selected by
Answer:

Related questions

0 votes
0 votes
1 answer
1
Bikram asked Feb 9, 2017
278 views
What feature of heaps allows them to be efficiently implemented using a partially filled array?Heaps are binary search trees.Heaps contain only integer data.Heaps are ful...
1 votes
1 votes
2 answers
2
Bikram asked Feb 9, 2017
293 views
A ternary tree is a tree in which every internal node has exactly three children.The number of leaves in a ternary tree with $’z’$ internal nodes is _______.$2$$\left...
0 votes
0 votes
1 answer
4