Question: . * A. A. TE = 1 Normal 1 No Spac... Heading 1 Heading Font Paragraph Styles CS 425 (Spring 2020), Date: 02/26/2020 Implementation of

 . * A. A. TE = 1 Normal 1 No Spac...
Heading 1 Heading Font Paragraph Styles CS 425 (Spring 2020), Date: 02/26/2020

. * A. A. TE = 1 Normal 1 No Spac... Heading 1 Heading Font Paragraph Styles CS 425 (Spring 2020), Date: 02/26/2020 Implementation of Heap Sort 1. Given an array of data, write functions to do the following: a) MaxHeapily/A, N, D-a void function that maximizes a node b) BuildMaxHeap A, N) c) HeapSortiA, N) Use the main function similar to previous exercises. You can create the array by calling Random number generator function, or you can give user input. Call BuildMaxHeap function first, and then display the array, Next call the Heap Sort function. Your output from the code must be displayed after calling each function. Pseudocode for MaxHeapify MaxHeapify (A, N, i) Begin: L = 2*i If (L = A[largest]) largest = R if (A[largest] > A[i]) swap (A[largest), Ail) Max Heapify (A, N, largest) end Heap Sort pseudocode HeapSort (A, N) Begin heapsize = N while (heapsize > 1) swap (A[1], A[heapsize]) heapsize = heapsize -1 MaxHeapify (A, heapsize, 1) end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!