public interface CS20Heap
Heap interface for CS 20 assignment 3, part 1, Summer 2009. A heap for String data that can function as either a max or min heap. Should have no capacity constraint.
Field Summary | |
---|---|
static int |
INITIAL_CAPACITY
Intended as the initial capacity of array used to implement the heap; and if array is filled, then capacity should be increased by this amount to allow unlimited inserts. |
Method Summary | |
---|---|
void |
clear()
Makes the heap logically empty. |
void |
insert(String item)
Insert item, maintaining heap order. |
boolean |
isEmpty()
Tests if the heap is logically empty. |
String |
removeTop()
Removes the top item from the heap, maintaining heap order. |
int |
size()
Return the size of the heap. |
String |
top()
Returns top item on heap, without removing it. |
Field Detail |
---|
static final int INITIAL_CAPACITY
Method Detail |
---|
void insert(String item)
item
- the item to insert.String top()
String removeTop()
int size()
boolean isEmpty()
void clear()