|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.Vector
heap.HeapAscending
public class HeapAscending
An implementation of a priority queue according to Cormen, Leiserson and Rivest. Sorts in ascending order.
Constructor Summary | |
---|---|
HeapAscending()
Constructs a heap with no elements. |
|
HeapAscending(Heapable[] anArray)
Constructs the heap in O(N) time, using a technique similar to bottom-up construction. |
Method Summary | |
---|---|
Heapable |
extract()
Removes the minimum (top) element from the Heap, decreases the size of the heap by one, and returns the minimum element. |
long |
getPriority()
|
void |
insert(Heapable key)
Inserts key into the heap, and then upheaps that key to a position where the heap property is satisfied. |
Heapable |
remove()
Removes an element from the heap. |
Methods inherited from class java.util.Vector |
---|
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize |
Methods inherited from class java.util.AbstractList |
---|
iterator, listIterator, listIterator |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface heap.HeapImpl |
---|
isEmpty, removeAllElements, size |
Methods inherited from interface java.util.List |
---|
iterator, listIterator, listIterator |
Constructor Detail |
---|
public HeapAscending(Heapable[] anArray)
public HeapAscending()
Method Detail |
---|
public Heapable extract() throws java.util.NoSuchElementException
extract
in interface HeapImpl
java.util.NoSuchElementException
public Heapable remove() throws java.util.NoSuchElementException
remove
in interface HeapImpl
java.util.NoSuchElementException
public void insert(Heapable key)
insert
in interface HeapImpl
public long getPriority()
getPriority
in interface HeapImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |