Question: 3 - Heaps [20/100 points] For this problem, consider the array of integers [64, 32, 16, 8, 4, 2] a. [8 points] Draw (as a

3 - Heaps [20/100 points] For this problem, consider the array of integers [64, 32, 16, 8, 4, 2] a. [8 points] Draw (as a tree), the min heap that would result from adding each integer in the above array to an initially empty min heap one at a time, in order (starting with the 64). b. [2 points] What was the total number of swaps required when creating the min heap in part (a)? (Note we are looking for the total number of individual swaps, not the number of calls to fixUp or fixDown) c. [8 points] Draw (as a tree), the min heap that would result from calling heapify on the above array. d. [2 points] What was the total number of swaps required when creating the min heap in part (c)? (Note we are looking for the total number of individual swaps, not the number of calls to fixUp or fixDown)

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!