Question: Question 5 A Given an array A [ 1 . . 7 ] = ( : 1 2 , 1 5 , 8 , 1

Question 5 A
Given an array A[1..7]=(:12,15,8,19,16,11,7:), run Build-Max-Heap (A,7). What will be the
resulting array A?
19,16,15,12,11,8,7>
19,12,11,15,16,8,7>
19,16,11,15,12,8,7>
19,16,11,12,15,8,7>
Question 5 B
Continue Question 5. Consider calling Build-Max-Heap (A,7) on array A[1..7]=,
.
(1) How many key comparisons were made by Build-Max-Heap (A,7) in total? Your answer should be a
single number.
---9---
(2) How many swaps were made by Build-Max-Heap (A,7) in total? Your answer should be a single
number.
---3??(---)
Question 7
Consider sorting an array A[1..5]=2,2,2,2,2> by calling Heapsort (A,5).
(1) How many calls will be made to Max-Heapify in total?
-?---?---
(2) How many swaps will be made in total?
--11
 Question 5 A Given an array A[1..7]=(:12,15,8,19,16,11,7:), run Build-Max-Heap (A,7). What

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!