Everything in the BinaryHeap
class has been written except the add and remove
methods, which you must write:
First, implement add, then uncomment the testAdd
method (including the "@Test" annotation)
in BinaryHeapTest and run the test class
Next, implement remove, uncomment the testRemove
method (including the "@Test" annotation) in
BinaryHeapTest and run the test class again
testAdd and testRemove should both run without
errors
Note:
A comp object implementing the Comparator
interface is passed to the binary heap's constructor.
You will need to use the comp object's compare
method when making comparisons in the add and remove
operations.
The parent, leftChild, and rightChild methods
in BinaryHeapTest are for testing purposes only, and
should not be
used to implement add and remove