Top
/
Data structures
/
Queues
/
HeapSort
/
Answer-heapsort-4
Answer to Question heapsort-4
Notice that the first value by itself is automatically a heap, so we start with k = 1.
void buildHeap(int A[], int n) { for(int k = 1; k < n; k++) { reheapUpMax(k, A); } }