Talk:Heap sort.c

I tried to sort with this implementation and I had the result like this: Input: 1 2 3 4 5 Sorted: 1 2 5 3 4

There is an error somewhere.

In line 3 of the heapSort function I edited the loop initialization from for (i = (array_size / 2)-1; i >= 0; i--) to for (i = array_size - 1; i >= 0; i--) And now it works!