public class PriorityQueue extends Object
| Constructor and Description |
|---|
PriorityQueue(int _n) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addElement(int index,
int value)
Adds an integer into the list.
|
void |
clear()
Clears the list.
|
boolean |
isEmpty()
Tests if the list is empty or not.
|
int |
pop()
Returns and removes the element with highest priority (i.e. lowest value) in O(1).
|
String |
toString() |
public boolean addElement(int index,
int value)
index - the element to insert.value - the value to be used for the comparison of the elements to add.true if and only if the list is not full.public int pop()
public boolean isEmpty()
true if and only if the list is empty.public void clear()
Copyright © 2017. All rights reserved.