From charlesreid1

Revision as of 03:23, 22 June 2017 by Admin (talk | contribs) (Created page with "Link on git.charlesreid1.com: https://charlesreid1.com:3000/cs/java/src/master/priority-queues/UnsortedPriorityQueue.java The unsorted priority queue makes adding very fast -...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Link on git.charlesreid1.com: https://charlesreid1.com:3000/cs/java/src/master/priority-queues/UnsortedPriorityQueue.java

The unsorted priority queue makes adding very fast - add operations are O(1), because items are just added to the end of the list, in no particular order.

Removing the minimum item is an O(N) operation, since the entire array must be traversed to find the minimum element. Note that finding the minimum also requires examining every item in the list.