Similar questions 3 more →
Heaps & Priority Queues

Answer & solution
Official answer: A
Approach: Use the heap-order property to restrict the maximum to leaves, then count leaves in the complete binary-tree shape.
1. In a min-heap every parent is smaller than its children because all keys are distinct. If the maximum were an internal node, its child would need to be still larger, a contradiction. Thus the maximum must be a leaf.
2. With one-based indexing, internal nodes are indices 1 through floor(105/2)=52. Leaves occupy indices 53 through 105, giving 105−52=53 leaves.
3. Every leaf is a feasible maximum location: place the largest key at the chosen leaf and assign the remaining keys in increasing order along a parent-before-child ordering of the remaining nodes. All parent-child inequalities can be satisfied.
Answer: A, 53. Zero-based indexing changes the leaf indices to 52 through 104 but not their number. The maximum is not fixed at the last array position; any leaf can hold it.