Question: Question 2 (3.5 points) Heapsort a) Is the array with values (23,17,14,6,13,10,1,5,7,12) a max-heap? Draw the tree-like plot, and identify the nodes that violate the

Question 2 (3.5 points) Heapsort a) Is the array with values (23,17,14,6,13,10,1,5,7,12) a max-heap? Draw the tree-like plot, and identify the nodes that violate the max-heap property. b) Using the plots on slide #31 to #34 (shown in figures below) as a model, illustrate the final outcome of calling MAX-HEAPIFY(A, 3) on the input array: A = (27,17,3,16,13,10,1,5,7,12,4,8,9,0). (Just need to draw two heap plots, one before the calling and one after.) MAX-HEAPIFY procedure -- example MAX-HEAPIFY procedure -- example GMAXEN O O NODE MAX-HEAPIFY procedure --example MAX-HEAPIFY procedure --example c) Call HEAPSORT on the input array A = (5,13,2,25,7,17,20,8,4). First, draw the resulting max-heap of calling BUILD-MAX-HEAP on A (line 1); then illustrate the elements in A after the first 2 iterations of the for loop (line 2 to 5) respectively, following slide #52 to #53 (shown below) HEAPSORT procedure (example) HEAPSORT procedure (example) Question 2 (3.5 points) Heapsort a) Is the array with values (23,17,14,6,13,10,1,5,7,12) a max-heap? Draw the tree-like plot, and identify the nodes that violate the max-heap property. b) Using the plots on slide #31 to #34 (shown in figures below) as a model, illustrate the final outcome of calling MAX-HEAPIFY(A, 3) on the input array: A = (27,17,3,16,13,10,1,5,7,12,4,8,9,0). (Just need to draw two heap plots, one before the calling and one after.) MAX-HEAPIFY procedure -- example MAX-HEAPIFY procedure -- example GMAXEN O O NODE MAX-HEAPIFY procedure --example MAX-HEAPIFY procedure --example c) Call HEAPSORT on the input array A = (5,13,2,25,7,17,20,8,4). First, draw the resulting max-heap of calling BUILD-MAX-HEAP on A (line 1); then illustrate the elements in A after the first 2 iterations of the for loop (line 2 to 5) respectively, following slide #52 to #53 (shown below) HEAPSORT procedure (example) HEAPSORT procedure (example)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
