Question: Please solve this ASAPPART 1 - An extended max heap operation A max heap is useful to implement another data structure Priority Queue, where you
Please solve this ASAPPART An extended max heap operation
A max heap is useful to implement another data structure Priority Queue, where you can always
have the highest priority value at the root of the heap, so that the system can easily gain access
to the most imminent task at a time.
In case we want to force the system to handle a certain task sooner, we might need to increase
a certain priority value inside the max heap while still maintaining the max heap property. For
this reason we may introduce the HeapIncrease routine, which is defined as:
HeapIncrease A i k
Given a max heap array of size n HeapIncrease A i k increases by
A How would you heapify the now changed heap array after Ai is increased? How would
you mitigate potential maxheap violations? To answer this question, you may either
Show your implementation of HeapIncrease using the following pseudocode
template;
or explain the mechanism in plain English, in no more than full sentences. pts
Hint: Recall the strict premise in order to apply MaxHeapify and how we do BuildHeap
from ground up
B And what is the BigOofn time complexity of your HeapIncrease routine?
pt Hint: There are two acceptable answers, depending on how you implement it in
HeapIncreaseA i k
Ai Ai k; assuming k is always positive
And then?
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
