Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

More Books

Students also viewed these Databases questions