
























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

























Applications of Priority Queues
Many, many applications.
Scheduling queues for a processor, print queues, transmit queues, backlogs, etc.….
This means this item will be in the front of queue
“Obtained” via a remove().
Note: a priority queue is no longer FIFO!
You will still remove from front of queue, but insertions are governed by a priority.
Applications of Priority Queues
Any event/job management that assign priority to events/jobs
In Operating Systems
Scheduling jobs
In Simulators
Scheduling the next event (smallest event time)
Priority Queues: Access Time
remove() So, the first item has priority and can be retrieved (removed) quickly and returned to calling environment. Hence, ‘remove()’ is easy (and will take O(1) time)
insert() (^) But, we want to insert quickly. Must go into proper position. (^) For our purposes here: Implementing data structure: array; (^) slow to insert(), but for (^) small number of items in the pqueue, and (^) where insertion speed is not critical, (^) this is the simplest and best approach.
(^) A binary heap is a partially ordered complete binary tree