Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

GATE | GATE-CS-2009 | Question 59

  • Last Updated : 28 Jun, 2021

Consider a binary max-heap implemented using an array. Which one of the following array represents a binary max-heap?

(A) 25,12,16,13,10,8,14
(B) 25,14,13,16,10,8,12
(C) 25,14,16,13,10,8,12
(D) 25,14,12,13,10,8,16


Answer: (C)

Explanation: A tree is max-heap if data at every node in the tree is greater than or equal to it’s children’ s data.

In array representation of heap tree, a node at index i has its left child at index 2i + 1 and right child at index 2i + 2.

           25
        /      \
      /          \
    14            16
   /  \           /  \
 /      \       /     \
13     10      8       12


Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!