E
- the type of elements held in this collection. It must implement
Comparablepublic class IndexedPriorityQueue<E extends java.lang.Comparable<E>>
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
class |
IndexedPriorityQueue.Node<T extends E> |
Constructor and Description |
---|
IndexedPriorityQueue(java.util.Collection<? extends E> c)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
E |
findMinimum() |
IndexedPriorityQueue.Node<E> |
getNode(int i) |
int |
size() |
void |
swap(IndexedPriorityQueue.Node<E> a,
IndexedPriorityQueue.Node<E> b)
Swaps the tree nodes a and b and updates the index structure properly
|
java.lang.String |
toString() |
void |
update(IndexedPriorityQueue.Node<E> n,
E new_value)
Updates a given node with a new value and moves entries in the tree
structure until the tree has the property that each parent is less than
its children
|
public IndexedPriorityQueue(java.util.Collection<? extends E> c)
c
- Collection containing the elements for the priority queue. It
has to be ordered.public void swap(IndexedPriorityQueue.Node<E> a, IndexedPriorityQueue.Node<E> b)
a
- b
- public void update(IndexedPriorityQueue.Node<E> n, E new_value)
n
- The node to be updatednew_value
- The new value for this nodepublic java.lang.String toString()
toString
in class java.lang.Object
public int size()
public E findMinimum()
public IndexedPriorityQueue.Node<E> getNode(int i)
i
-