Priority Queues/Unsorted: Difference between revisions
From charlesreid1
(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 -...") |
No edit summary |
||
| Line 1: | Line 1: | ||
==Git Code== | |||
Link on git.charlesreid1.com: https://charlesreid1.com:3000/cs/java/src/master/priority-queues/UnsortedPriorityQueue.java | Link on git.charlesreid1.com: https://charlesreid1.com:3000/cs/java/src/master/priority-queues/UnsortedPriorityQueue.java | ||
==Notes== | |||
{{Main|Priority Queues}} | |||
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. | 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. | 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. | ||
==Flags== | |||
[[Category:Priority Queues]] | |||
[[Category:Queues]] | |||
{{StacksQueuesFlag}} | |||
Revision as of 03:41, 22 June 2017
Git Code
Link on git.charlesreid1.com: https://charlesreid1.com:3000/cs/java/src/master/priority-queues/UnsortedPriorityQueue.java
Notes
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.
Flags
| Stacks and Queues Part of Computer Science Notes
Series on Data Structures
Stacks and Queues: Python StacksQueues/Python · StacksQueues/Python/ArrayStack · StacksQueues/Python/ArrayQueue · StacksQueues/Python/ArrayDeque StacksQueues/Python/LinkedStack
Stacks and Queues: Java StacksQueues/Java · StacksQueues/Java/ArrayStack · StacksQueues/Java/ArrayQueue · StacksQueues/Java/ArrayQueueFS · StacksQueues/Java/ArrayDeque StacksQueues/Java/LinkedStack · StacksQueues/Java/LinkedQueue · StacksQueues/Java/LinkedDeque
Applications Postfix_Expressions#Stacks · StacksQueues/Subsets · StacksQueues/Subsets/Java
|