A job scheduler receives the priority array [29,14,36,8,23,17][29,14,36,8,23,17][29,14,36,8,23,17], where smaller numbers indicate higher priority. Construct a binary min-heap in place using zero-based indices and bottom-up heap construction.
Process internal indices 222, 111, and 000, in that order. At each index, sift down by swapping with the smaller existing child whenever necessary. Continue until that subtree satisfies min-heap order. The children of index iii are at 2i+12i+12i+1 and 2i+22i+22i+2 when those indices exist.
Complete every array entry after each entire sift-down finishes. Enter exact integers; priorities are unitless.
Unlock full course notes by signing up
Array contents after delete-min
A binary min-heap is stored in a 0-indexed array, so the children of index iii are at indices 2i+12i+12i+1 and 2i+22i+22i+2. The array currently holds:
2, 6, 4, 11, 8, 5, 9, 13, 12, 10
One delete-min (extract-min) operation is performed using the standard method: remove the root, move the last element into the root position, shrink the array by one, and sift that element down. Enter the value stored at each index of the nine-element array after the operation.
Retaining the fastest readings in a stream
A response-time logger retains the five smallest readings seen so far using a binary heap containing exactly five readings. It has already processed 626262, 454545, 575757, 282828, and 39 ms39\ \text{ms}39 ms, and all five are currently retained.
The logger then receives these readings in order: