Question: roblem (100 points) Design Heapsort Using a Min-Heap he objective of this exercise is to use a Min-Heap to implement Heapsort sort an array A.
roblem (100 points) Design Heapsort Using a Min-Heap he objective of this exercise is to use a Min-Heap to implement Heapsort sort an array A. a) ( 10 points) Define what a min-heap is. b) ( 10 points) Consider the array A=. Draw this as a heap and explain whether it is a min-heap or not. For your convenience, you may draw by hand the resulting heap, take a picture of your drawing, and insert it in this file. Just insure your drawing is neat and pleasant. C) ( 15 points) The following is the Max-Heapify(A, 1 ) procedure. MAX-HEAPIFY (A,i) l2345678910l=LEFT(i)r=RIGHT(i)iflA.heap-sizeandA[l]>A[i]largest=1elselargest=iifrA.heap-sizeandA[r]>A[largest]largest=riflargest=iexchangeA[i]withA[largest]MaX-HEAPIFY(A.largest) Rewrite Max-Heapify( (A,i) into Min-Heapify (A,i) to help building a min-heap. d) (25 points) Execute your procedure Min-Heapify (A, 1) to the array A=45;23;31;27;29;35;39;49;31;44. Provide what the array A becomes after the execution of each recursive MinHeapify (A,1) and draw the resulting heap. You must provide the representation as an array and a heap. You may draw by hand the resulting heap, take a picture of your drawing, and insert it in this file. Just insure your drawing is neat and pleasant. e) (40 points) Analyze the time complexity of your MinHeapify (A,i) procedure. 1. (25 points) Let us assume that when a heap rooted at Node contains n nodes, then the subtrees rooted at or contain at most nodes where. Based on this assumption, derive the recurrence relation for Min-Heapify(A,i), Be as precise as Student 3 (see Appendix). 2. ( 15 points) Assume that a=3 and b=4. Solve the recurrence relation you found in the previous
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
