Language: EN FI

Exercises > Heapsort

These exercises demonstrate the content of the ByTheMark service. These are meant for private individuals for learning data structures and algorithms. If you want to try out more content, you can register to the ByTheMark Personal free of charge.

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

  Last modified Tue Mar 01 20:54:04 EET 2011