Question: Consider a heap implemented with 0-based indexing. Suppose an array of twelve elements, a[12], is initialized with a[i] = 20-i for each i, and suppose
Consider a heap implemented with 0-based indexing.
Suppose an array of twelve elements, a[12], is initialized with a[i] = 20-i for each i, and suppose this array is to be revised into a heap---following the algorithm used in a Heap Sort. What rearrangements, if any, need to be done in order to make the corresponding tree structure into a heap? Show the data in the array once a heap is achieved.
Suppose the array of twelve elements, a[12], is initialized with a[i] = i for each i, and suppose this array is to be revised into a heap---following the algorithm used in a Heap Sort. What rearrangements, if any, need to be done in order to make the corresponding tree structure into a heap? Show the data in the array once a heap is achieved.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
