Question: Java:Implement the binary heap ( min - heap ) a ) Write functions to implement Parent ( i ) , LeftChild ( i ) and

Java:Implement the binary heap (min-heap)
a) Write functions to implement Parent(i), LeftChild(i) and RightChild(i).
b) Write a constructor to create an empty heap with a given maxSize.
c) Implement SiftUp(i).
d) Implement Insert(p).
e) Test your code by creating the heap given in the slides, (16,10,14,9,7,1,4,2,8,3).
f) If you change the order of the numbers that are entered, do you get the same tree?
g) If the answer to part f is no, explain why it doesn't matter.
h) Implement SiftDown(i).
i) Implement ExtractMax().
j) Implement Remove(i).
k) Write tests for all the functions.
 Java:Implement the binary heap (min-heap) a) Write functions to implement Parent(i),

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!