[Solved] Heap Sort doesn’t work properly
In the comments, you mention that you’re using array indexes in the interval 1..N for an array of size N+1, but the size you pass in is N+1. If that’s true, you have an off-by-one error in max-heapify(): if size is N+1, the last position you can access is N, not N+1, so you must … Read more