Given an array [3, 1, 8, 5, 4, 7, 6], I want to show the result of the first two iterations of heap sort, plus the result of initial build-heap to make a max heap.
Here is what I have so far
Initial: [3, 1, 8, 5, 4, 7, 6]
After max-heap: [8, 5, 7, 1, 4, 3, 6]
After 1st iter: [7, 5, 6, 1, 4, 3, 8]
After 2nd iter: [6, 4, 5, 1, 3, 7, 8]
Is my answer correct?
I am mostly concerned with the second iteration, as my professor said I got the second iteration wrong, but I cannot figure out where I went wrong with it.