/**
* Heap.java<BR>
* Heap ADT interface for min-heap.
* A Heap is a very simple priority queue, where key values are
* restricted to be integers, and there is no associated data.
*/
public interface Heap {
/**
* Insert a new value into the priority queue.
* @param key The key value to insert.
*/
public int insert(int key);
/**
* Get the minimum value in the priority queue.
* @return The minimum value.
*/
public int min();
/**
* Remove the smallest key value from the priority queue.
*/
public int removeMin();
/**
* Is the priority queue empty?
* @return true if and only if the priority queue is empty.
*/
public boolean isEmpty();
/**
* Size of the priority queue.
* @return Number of key values in priority queue.
*/
public int size();
/**
* Is the priority queue in Min-Heap order? Do not modify the
* implementation of this method.
*
* @return true if and only if the priority queue is in heap order.
*/
public boolean testHeap();
}
Powered by
GeSHi Syntax Highlighting software.
Author of all (other) material unless otherwise specified:
Loren Segal. Copyright 2005.