public class KAryHeap<T> extends java.lang.Object implements ExtendedPriorityQueue<T>
Constructor and Description |
---|
KAryHeap(int k,
java.util.Comparator<? super T> c) |
Modifier and Type | Method and Description |
---|---|
void |
decrease(long id) |
void |
insert(T element)
Inserts an element into the queue.
|
long |
insertWithId(T element) |
static <S extends java.lang.Comparable<? super S>> |
naturallyOrdered(int k) |
T |
peek()
Peeks into the top of the queue, returning the element which is believed to have
minimal key.
|
T |
pop()
Peeks into the top of the queue, returning the element which is believed to have
minimal key.
|
int |
size()
Returns the size of the queue.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
corrupted
empty
public KAryHeap(int k, java.util.Comparator<? super T> c)
public static <S extends java.lang.Comparable<? super S>> KAryHeap<S> naturallyOrdered(int k)
public int size()
SoftPriorityQueue
size
in interface SoftPriorityQueue<T>
public void decrease(long id)
decrease
in interface ExtendedPriorityQueue<T>
public void insert(T element)
SoftPriorityQueue
insert
in interface SoftPriorityQueue<T>
element
- the element to be insertedpublic long insertWithId(T element)
insertWithId
in interface ExtendedPriorityQueue<T>
public T peek()
SoftPriorityQueue
peek
in interface SoftPriorityQueue<T>
public T pop()
SoftPriorityQueue
pop
in interface SoftPriorityQueue<T>