Package algs24
Class MyMinMaxPQ<K extends Comparable<? super K>>
java.lang.Object
algs24.MyMinMaxPQ<K>
- All Implemented Interfaces:
Iterable<K>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondelMax()
Delete and return the largest key on the priority queue.delMin()
Delete and return the smallest key on the priority queue.void
Add a new key to the priority queue.boolean
isEmpty()
Is the priority queue empty?boolean
isFull()
Is the priority queue full?iterator()
Return an iterator that iterates over all of the keys on the priority queue in ascending order.static void
min()
Return the smallest key on the priority queue.int
size()
Return the number of items on the priority queue.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
MyMinMaxPQ
-
-
Method Details
-
isEmpty
Is the priority queue empty? -
isFull
Is the priority queue full? -
size
Return the number of items on the priority queue. -
min
Return the smallest key on the priority queue. Throw an exception if the priority queue is empty. -
insert
Add a new key to the priority queue. -
delMin
Delete and return the smallest key on the priority queue. Throw an exception if the priority queue is empty. -
delMax
Delete and return the largest key on the priority queue. Throw an exception if the priority queue is empty. -
iterator
Return an iterator that iterates over all of the keys on the priority queue in ascending order.The iterator doesn't implement
remove()
since it's optional.- Specified by:
iterator
in interfaceIterable<K extends Comparable<? super K>>
-
main
-