As a homework problem, I have to draw out the max heap from an array. The question reads:
Please draw out the max-heap stored in the following array (heapsize is 6) A[] = {15,10,8,5,2,7,20,30}
So, when I attempted this question, I just did it the old fashioned way, and did not take into account that the heapSize is less than the array size.
The max heap I got was: {30,20,15,10,2,7,8,5}
My question is: Is this correct? Also, now that the heapSize is lesser than the array size, how does this affect the max heap produced? Should I only show the max heap array till the 6th element or should I modify my max heap?
Thanks!