public class PriorityQueue
extends java.lang.Object
| Constructor and Description |
|---|
PriorityQueue(double[] a)
Constructor.
|
PriorityQueue(int d,
double[] a)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
change(int k)
The priority of item k has changed.
|
boolean |
empty()
Returns true if the queue is empty.
|
void |
insert(int v)
Insert a new item into queue.
|
void |
lower(int k)
The value of item k is lower (higher priority) now.
|
int |
poll()
Removes and returns the index of item with minimum value (highest priority).
|
public PriorityQueue(double[] a)
a - external array of priority. Lower value means higher priority.public PriorityQueue(int d,
double[] a)
d - d-heap.a - external array of priority. Lower value means higher priority.public boolean empty()
public void insert(int v)
v - the index of item.public int poll()
public void lower(int k)
public void change(int k)