My Priority Queue API
Two concrete priority queue classes and one abstract priority queue class implemented in Java. These classes can be found at git.charlesreid1.com: https://charlesreid1.com:3000/cs/java/src/master/priority-queues/PriorityQueueBase.java
Java Collections Priority Queue
You can also find an implementation of a Priority Queue in the Java Collections API.
Priority Queue Base Class
AbstractPriorityQueue class: https://charlesreid1.com:3000/cs/java/src/master/priority-queues/AbstractPriorityQueue.java
This base class is an abstract class that defines a key-value item utility class, defines a few concrete methods, and defines several abstract methods.
See Priority Queues/ADT for more code.
Sorted Priority Queue
This class implements a sorted priority queue using an O(N) insertion sort for each add operation (start from the back, swap your way toward the front) and a built-in Java Collections API Linked List (a doubly-linked list).
Slow add, fast remove.
Unsorted Priority Queue
This class implements an unsorted priority queue that does not keep track of the minimum element and must perform an O(N) sequential search for each removal operation.
Fast add, slow remove.
Priority Queues and HeapsPart of Computer Science Notes
Series on Data Structures
Performance: Priority Queues/Timing and Performance
Flags · Template:PriorityQueuesFlagBase · e