All Packages Class Hierarchy This Package Previous Next Index
Class DataStructures.BinaryHeap
java.lang.Object
|
+----DataStructures.BinaryHeap
- public class BinaryHeap
- extends Object
Implements a binary heap.
Note that all "matching" is based on the compareTo method.
BinaryHeap()
- Construct the binary heap.
BinaryHeap(int)
- Construct the binary heap.
deleteMin()
- Remove the smallest item from the priority queue.
findMin()
- Find the smallest item in the priority queue.
insert(Comparable)
- Insert into the priority queue, maintaining heap order.
isEmpty()
- Test if the priority queue is logically empty.
isFull()
- Test if the priority queue is logically full.
main(String[])
-
makeEmpty()
- Make the priority queue logically empty.
BinaryHeap
public BinaryHeap()
- Construct the binary heap.
BinaryHeap
public BinaryHeap(int capacity)
- Construct the binary heap.
- Parameters:
- capacity - the capacity of the binary heap.
insert
public void insert(Comparable x) throws Overflow
- Insert into the priority queue, maintaining heap order.
Duplicates are allowed.
- Parameters:
- x - the item to insert.
- Throws:
Overflow
- if container is full.
findMin
public Comparable findMin()
- Find the smallest item in the priority queue.
- Returns:
- the smallest item, or null, if empty.
deleteMin
public Comparable deleteMin()
- Remove the smallest item from the priority queue.
- Returns:
- the smallest item, or null, if empty.
isEmpty
public boolean isEmpty()
- Test if the priority queue is logically empty.
- Returns:
- true if empty, false otherwise.
isFull
public boolean isFull()
- Test if the priority queue is logically full.
- Returns:
- true if full, false otherwise.
makeEmpty
public void makeEmpty()
- Make the priority queue logically empty.
main
public static void main(String[] args)
All Packages Class Hierarchy This Package Previous Next Index