public class MaxHeap<E1,E2 extends java.lang.Comparable<E2>>
extends java.lang.Object
Constructor and Description |
---|
MaxHeap() |
Modifier and Type | Method and Description |
---|---|
void |
add(E1 e,
E2 c)
Adds an element to the heap
|
E1 |
extractMax()
Returns the maximum element in the heap and deletes it
|
E1 |
getMax()
Peeks at the root of the heap (not removing it)
|
int |
getSize()
Returns the number of elements in the heap
|
boolean |
isEmpty()
Whether the heap is empty
|
public boolean isEmpty()
public void add(E1 e, E2 c)
e
- the item to be addedc
- the key with respect to which the order is maintainedpublic E1 extractMax()
public E1 getMax()
public int getSize()