Question: Please solve with pen and paper and upload the answer. Please solve the question in its entirety addressing all parts or else... Thanks. 2. Suppose

Please solve with pen and paper and upload the answer. Please solve the question in its entirety addressing all parts or else... Thanks.

Please solve with pen and paper and upload the answer. Please solve

2. Suppose we start with 2 max heaps of 2P 1 elements each and we have n additional numbers on the side. We combine these max heaps two at a time by picking one of the numbers as a new root, attaching two max heaps as its left and right children, then running maxheapify on that root. We continue combining max heaps this way until there is just one big max heap remaining. When combining max heaps we always choose two max heaps of equal size. The number n is exactly as required to make this work. Answer the following questions (and simplify your answers as much as possible: DO NOT leave any summation): (a) In the worst case scenario, what is the total number of swaps that will be made as a function of p and k7 Your answer should be simplified as much as possible. Answer (b) Show work below. Work is graded! Solution

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 Mathematics Questions!