Data Structure (2130702)

BE | Semester-3   Winter-2017 | 11/03/2017

Q5) (a)

How does priority queue work?

  • A queue in which we are able to insert remove items from any position based on some property (such as priority of the task to be processed) is often referred as priority queue.
  • Below fig. represent a priority queue of jobs waiting to use a computer.
  • Priorities of 1, 2, 3 have been attached with jobs of real time, online and batch respectively. Therefore if a job is initiated with priority i,it is inserted immediately at the end of list of other jobs with priorities i. Here jobs are always removed from the front of queue.
Priority-Queue