Heap Practice Quiz
Practice Problem
Take out a piece of paper and put your name on the upper right corner.
Write a reHeap() method for the following Max Heap.
public class MaxHeap<E> {
private E[] heap;
private Comparator<E> c;
private int size;
/**
* Re-heap the heap so that the largest value is on top of
* the heap. Assume the new item is at size - 1.
*/
private void reHeap() {
// your code
}
}
Time Remaining:
You can restart the timer by reloading the page.
Try to complete the problem in 15 minutes.
If you cannot complete the program in 15 minutes, you can watch me solve the problem in a text editor.