Two Pops Later

A zero-indexed array-backed min-heap, drawn with each element's array index beside it:

Min-heap stored as the array 2 5 4 9 7 6 8 2 5 4 9 7 6 8 [0] [1] [2] [3] [4] [5] [6]

Each pop returns the root, moves the last element into the root slot, shrinks the array by one, and sifts that element down. Run pop twice.

What is the array afterwards?

A

[6, 7, 5, 9, 8]

B

[5, 7, 6, 9, 8]

C

[5, 6, 7, 9, 8]

D

[5, 9, 6, 7, 8]