In the Heap class, we used two separate arrays: one for the heap and another for the sorted list. It turns out we can do everything with just one array. Notice that the heap will decrease in size by one element after every rebuild step. The unused space at the end of the heap array can be used to store the sorted list. Modify the Heap class so it will use only one array.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.