Official answer: A) 10, 8, 7, 3, 2, 1, 5
Binary HeapsInitially, the heap elements in level-order (array representation) are:
[10,8,5,3,2] Insert 1:
1 is added at index 6 (as the left child of node 5 at index 3).
Since 1≤5, no swapping is needed.
Heap array becomes: [10,8,5,3,2,1]
Insert 7:
7 is added at index 7 (as the right child of node 5 at index 3).
Heap array before bubbling up: [10,8,5,3,2,1,7]
Compare 7 with its parent 5: since 7>5, swap 7 and 5.
Heap array becomes: [10,8,7,3,2,1,5]
Compare 7 with its new parent 10: since 7≤10, heap property is satisfied.
The resulting level-order traversal is 10, 8, 7, 3, 2, 1, 5, which corresponds to option (A).