Package algs24
Class MyPtrHeap<K extends Comparable<? super K>>
java.lang.Object
algs24.MyPtrHeap<K>
The
PMytrHeap
class is the priorityQ class from Question 2.4.24. It
represents a priority queue of generic keys.
It supports the usual insert and delete-the-maximum
operations, along with methods for peeking at the maximum key, testing if the
priority queue is empty, and iterating through the keys. For additional
documentation, see Section
2.4 of Algorithms, 4th Edition by Robert Sedgewick and Kevin
Wayne.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondelMax()
Delete and return the largest key on the priority queue.void
Add a new key to the priority queue.boolean
isEmpty()
Is the priority queue empty?static void
max()
Return the largest key on the priority queue.int
size()
Return the number of items on the priority queue.
-
Constructor Details
-
MyPtrHeap
public MyPtrHeap()Create an empty priority queue
-
-
Method Details
-
isEmpty
Is the priority queue empty? -
size
Return the number of items on the priority queue. -
max
Return the largest key on the priority queue. Throw an exception if the priority queue is empty. -
insert
Add a new key to the priority queue. -
delMax
Delete and return the largest key on the priority queue. Throw an exception if the priority queue is empty. -
main
-