Home » Programming & Data Structure » Programming and data structure miscellaneous » Question

Programming and data structure miscellaneous

Programming & Data Structure

Direction: Consider a binary max-heap implemented using an array :

  1. Which one of the following array represents a binary maxheap?
    1. {25, 12, 16, 13, 10, 8, 14}
    2. {25, 14, 13, 16, 10, 8, 12}
    3. {25, 14, 16, 13, 10, 8, 12}
    4. {25, 14, 12, 13, 10, 8, 16}
Correct Option: C

Suppose that we have a node x, then for the condition 1 < = x < = n/2 and A[x] > = A[2x + 1] where 2x and 2x + 1 are left child and right child of the node x respectively of a binary max-heap.
Thus, under given cases the tree obtained is.



Your comments will be displayed only after manual approval.