Priority Queues/Java
From charlesreid1
Two concrete priority queue classes and one abstract priority queue class implemented in Java. These classes can be found at git.charlesreid1.com:
Sorted Priority Queue
SortedPriorityQueue class: https://charlesreid1.com:3000/cs/java/src/master/priority-queues/SortedPriorityQueue.java
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
UnsortedPriorityQueue class: https://charlesreid1.com:3000/cs/java/src/master/priority-queues/UnsortedPriorityQueue.java
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.