Question: ( a ) What are the differences if any between a Heap array and a sorted array? What are the main advantages of a binary
a What are the differences if any between a Heap array and a sorted array?
What are the main advantages of a binary Heap compared to both an unsorted array and
a sorted array from the point of view of insert and remove operations?
marks
b Draw the following heap array as a twodimensional binary tree data structure:
Also, assuming another array hPos is used to store the position of each key in the
heap, show the contents of hPos for this heap.
marks
c By using tree and array diagrams, illustrate the effect of inserting a node whose key is
into the heap in the array of part b You can ignore effects on Pos
marks
d By using tree diagrams, illustrate the effect of a remove operation on the modified heap
from part c
marks
e Write in pseudocode a recursive version, maxHeapifyint k of the siftDownint k
Heap operation.
marks
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
