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?
(6 marks)
(b) Draw the following heap array as a two-dimensional 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.
(6 marks)
(c) By using tree and array diagrams, illustrate the effect of inserting a node whose key is
13 into the heap in the array of part (b). You can ignore effects on h Pos[].
(9 marks)
(d) By using tree diagrams, illustrate the effect of a remove operation on the modified heap
from part (c).
(5 marks)
(e) Write in pseudocode a recursive version, maxHeapify(int k), of the siftDown(int k)
Heap operation.
(7 marks)
 (a) What are the differences if any between a Heap array

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