Similar questions 4 more → · asked again: GATE 2014 Set 2, Q12
Heaps & Priority Queues

Answer & solution
Answer: D (no official key was published)
Step through it (5 steps)
Append 1 as the sixth element; its parent 5 is larger, so no swap occurs. Append 7 as the seventh element; swap it with parent 5, but stop below root 10. The resulting level order is 10, 8, 7, 3, 2, 1, 5, D.
Appending 1 puts it under parent 5 and requires no upward swap. Appending 7 puts it as the other child of 5;7 exceeds 5, so swap them. Its new parent is 10, which is larger, ending the repair. Other nodes remain where they were, yielding 10, 8, 7, 3, 2, 1, 5. A heap is not a sorted array; sorting the level order would unnecessarily rearrange nodes.