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.


Constructor Index

 o BinaryHeap()
Construct the binary heap.
 o BinaryHeap(int)
Construct the binary heap.

Method Index

 o deleteMin()
Remove the smallest item from the priority queue.
 o findMin()
Find the smallest item in the priority queue.
 o insert(Comparable)
Insert into the priority queue, maintaining heap order.
 o isEmpty()
Test if the priority queue is logically empty.
 o isFull()
Test if the priority queue is logically full.
 o main(String[])
 o makeEmpty()
Make the priority queue logically empty.

Constructors

 o BinaryHeap
public BinaryHeap()
Construct the binary heap.

 o BinaryHeap
public BinaryHeap(int capacity)
Construct the binary heap.

Parameters:
capacity - the capacity of the binary heap.

Methods

 o 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.
 o findMin
public Comparable findMin()
Find the smallest item in the priority queue.

Returns:
the smallest item, or null, if empty.
 o deleteMin
public Comparable deleteMin()
Remove the smallest item from the priority queue.

Returns:
the smallest item, or null, if empty.
 o isEmpty
public boolean isEmpty()
Test if the priority queue is logically empty.

Returns:
true if empty, false otherwise.
 o isFull
public boolean isFull()
Test if the priority queue is logically full.

Returns:
true if full, false otherwise.
 o makeEmpty
public void makeEmpty()
Make the priority queue logically empty.

 o main
public static void main(String[] args)

All Packages  Class Hierarchy  This Package  Previous  Next  Index