A priority queue is a collection of elements where the elements are stored according to their priority levels. The order in which the elements should get added or removed is decided by the priority of the element. Following rules are applied to maintain a priority queue.
(a) The element with a higher priority is processed before any element of lower priority.
(b) If there are elements with the same priority, then the element added first in the queue would get processed.
Priority queues are used for implementing job scheduling by the operating system where jobs with higher priorities are to be processed first. Another application of priority queues is simulation systems where priority corresponds to event limes.
(a) The element with a higher priority is processed before any element of lower priority.
(b) If there are elements with the same priority, then the element added first in the queue would get processed.
Priority queues are used for implementing job scheduling by the operating system where jobs with higher priorities are to be processed first. Another application of priority queues is simulation systems where priority corresponds to event limes.