Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pleaser justify your answers Problem (100 points) Design Heapsort Using a Min-Heap The objective of this exercise is to use a Min-Heap to implement Heapsort

Pleaser justify your answers image text in transcribed
Problem (100 points) Design Heapsort Using a Min-Heap The objective of this exercise is to use a Min-Heap to implement Heapsort to sort an array A. a) (2 points) Define what a min-heap is. b) (3 points) Consider the array A . Draw this as a heap and explain whether it is a min-heap or not. You may draw by hand the resulting heap, take a picture of your drawing, and insert it in this file. c) (10 points) The following is the Max-Heapify (A,i) procedure. MAX-HEAPIFY (A, i) 1 1 LEFT(i) 2 r-RIGHT(i) 3 ifl A[i] 4 5 else largesti 6 if r A.heap-size and Ar]> Allargest) 7 largest 8 if largest 9 exchange Ali] with Allargest] 10 MAX-HEAPIFY (A, largest) largest l Rewrite Max-Heapify(A.) into Min-Heapify(A,I) to help building a min-heap. d) (5 points) Execute your procedure Min Heapify(AI) to the array A=. Provide what the array A becomes after the execution of Min-Heapify 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. e) (10 points) Analyze the time complexity of your Min-Heapify(A.i) procedure

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

Step: 3

blur-text-image

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

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions