|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cometway.util.BinaryHeap
public class BinaryHeap
BinaryHeap is a mostly vanilla implementation of the CLR binary heap (albeit an object-oriented implementation), with the addition of a Hashtable mapping IHeapItems to their respective indices in the heap Vector. this allows for (nearly) constant time deletion of arbitrary IHeapItems at the cost of a bit of hashing (ohhh, sweet hash...)
| Constructor Summary | |
|---|---|
BinaryHeap()
UNICONSTRUCTOR |
|
| Method Summary | |
|---|---|
boolean |
delete(IHeapItem deleteItem)
delete |
IHeapItem |
deleteMin()
deleteMin: method removes and returns the minimum IHeapItem in this heap |
boolean |
empty()
empty: method returns true if this heap contains no elements and false otherwise. |
IHeapItem |
findMin()
findMin: method returns the minimum IHeapItem in this heap |
boolean |
insert(IHeapItem newItem)
insert: method adds a IHeapItem to this heap |
boolean |
isEmpty()
isEmpty: method returns true if this heap contains no elements and false otherwise |
void |
print()
|
int |
size()
size: method returns the number of elements in this heap |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BinaryHeap()
| Method Detail |
|---|
public boolean insert(IHeapItem newItem)
insert in interface IHeappublic boolean delete(IHeapItem deleteItem)
delete in interface IHeappublic IHeapItem findMin()
findMin in interface IHeappublic IHeapItem deleteMin()
deleteMin in interface IHeappublic boolean isEmpty()
isEmpty in interface IHeappublic boolean empty()
public int size()
size in interface IHeappublic void print()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||