Design and Analysis of Algorithms20765 marksNumerical: heap sort traceSorting Algorithms
Trace heap sort algorithm for the following data: (2, 9, 3, 12, 15, 8, 11)
Trace heap sort algorithm for the following data: (2, 9, 3, 12, 15, 8, 11) [5]
- Array (0-indexed): $A = [2, 9, 3, 12, 15, 8, 11]$, size $n = 7$ - Sort in ascending order using Max-Heap. Index relations: left child $= 2i+1$, right child $= 2i+2$. --- Last non-leaf node $= \lfloor n/2 \rfloor - 1 = 2$. Heapify from index 2 down to 0. Heapify index 2 (value 3): children 8 (id...