Heapsort

Hide text Hide pseudo-code

The HeapSort algorithm has been executed until line 2. In the figure, you can see the input array (both as an array and a binary tree representations). Continue the execution from line 2.

HeapSort(array heap, int heapsize)
1. BuildHeap(heap, heapsize)
2. while heapsize > 1 do
3.   heap[heapsize-1] = 
        DeleteMax(heap, heapsize) 
4.   heapsize = heapsize - 1


  Created Wed Jun 20 16:00:42 EEST 2007 - Powered by SVG-hut