Question: Below are three different methods for building a max - heap. Suppose that A [ 1 , 2 , . . . , n ]
Below are three different methods for building a maxheap. Suppose that A n initially contains n elements, which are not necessarily in heap format. You may assume that the value of Aheapsize n For each method, justify whether the method correctly. builds a maxheap. If so justify your answer. If not, provide an example showing it doesnt work. METHOD : Initial call: MakeHeapA n MakeHeapA i If i BubbleupAi MakeHeapAi METHOD : Initial call: MakeHeapA n MakeHeapA i If i BubbledownAi MakeHeapAi METHOD : Initial call: MakeHeapA MakeHeapA i If i Aheapsize BubbleupAi MakeHeapAi
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
