Direction: Consider a binary max-heap implemented using an array :
-
Which one of the following array represents a binary maxheap?
-
- {25, 12, 16, 13, 10, 8, 14}
- {25, 14, 13, 16, 10, 8, 12}
- {25, 14, 16, 13, 10, 8, 12}
- {25, 14, 12, 13, 10, 8, 16}
- {25, 12, 16, 13, 10, 8, 14}
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.