Question: There is a MAX-heap where each node has four subtrees which are less than it and this MAX-heap starts out with n values in it.
There is a MAX-heap where each node has four subtrees which are less than it and this MAX-heap starts out with n values in it.
If delete() is called n times to remove the items from heap one by one in descending order, what will be the total cost to delete all elements from heap in this manner?
Note: delete() is the algorithm where we take the value currently in node that needs to be removed and copy it in the root and fix the heap as needed due to data movement.
Be sure to include constants in front of largest order term for this problems. You are looking at the number of data comparisons in worst case if heap starts with n values.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
