Heaps and Heapsort Homework -

1) Insert in the given left to right order the following elements into an initially empty heap.  Draw the heap in tree form after each insert is complete.

13, 26, 27, 84, 55, 66, 77, 58, 90, 88

 

2) Perform the heapsort algorithm on the array below.  Show the "swaps" at each stage as you reheapify the heap.

 

index     0        1        2        3        4        5        6        7        8        9

value    95    40        50    38        35        42    10    30          5        3