E - Item.public class BinaryHeap<E extends java.lang.Comparable<E>>
extends java.lang.Object
| Constructor and Description |
|---|
BinaryHeap()
Initializes a new instance of the BinaryHeap class.
|
BinaryHeap(E[] keys)
Initializes a new instance of the BinaryHeap class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(E node)
Adds an item in the heap.
|
int |
count()
Get the count actually in the heap.
|
boolean |
isEmpty()
Check if the heap is empty.
|
E |
min()
Get the minimum item from the heap.
|
E |
remove()
Remove the last node from the heap.
|
void |
remove(E item)
Remove a specified item from the heap.
|
int |
size()
Get the size of the heap.
|
public BinaryHeap()
public BinaryHeap(E[] keys)
keys - Items.public int count()
public int size()
public void add(E node)
node - Item as node.public E remove()
public void remove(E item)
item - Item.public E min()
public boolean isEmpty()