T
- object typepublic final class PriorityQ<T> extends Object
Constructor and Description |
---|
PriorityQ(int maxSize,
Comparator<T> c)
Construct a priority queue with a given capacity
|
Modifier and Type | Method and Description |
---|---|
void |
buildHeap()
build the heap...
|
boolean |
isEmpty()
Check whether the heap is empty.
|
T |
peek()
Look at the top of the heap
|
void |
percolateDown()
Signals that the element on top of the heap has been updated
|
T |
poll()
Remove the element on top of the heap
|
int |
size() |
void |
toss(T t)
Add an element at the end of the queue
|
public PriorityQ(int maxSize, Comparator<T> c)
maxSize
- capacityc
- comparatorpublic int size()
public void toss(T t)
t
- element to be addedpublic T peek()
public void buildHeap()
public void percolateDown()
public T poll()
public boolean isEmpty()
Copyright © 2016. All Rights Reserved.