Question: Consider an array of size nine with the numbers in the following order: 40, 60, 20, 80, 70, 90, 30, 10, 50. (a) Create

Consider an array of size nine with the numbers in the following order: 40, 60, 20, 80, 70, 90, 30, 10, 50. (a) Create the heap using the algorithm described in class. Show the heap as a tree. Show the heap as an array. Exactly how many comparisons did heap creation use? (b) Start with the heap created in Part (a). Show the array after each element sifts down during the Finish phase. How many comparisons does each sift use? What is the total number of comparisons after heap creation?
Step by Step Solution
There are 3 Steps involved in it
a Creating the heap using the algorithm described in class The given array is 40 60 20 80 70 90 30 1... View full answer
Get step-by-step solutions from verified subject matter experts
