Chapter: Object Oriented Programming and Data Structure : Linear Data Structures

Priority Queue

State and explain the priority queue with example. Priority Queue

State and explain the priority queue with example. Priority Queue

 

- is a queue where each data has an associated key that is provided at the time of insertion. - Dequeue operation deletes data having highest priority in the list

- One of the previously used dequeue or enqueue operations has to be modified

 

Example: Consider the following queue of persons where females have higher priority than males (gender is the key to give priority).

 

Dequeue()- deletes Aster Dequeue()- deletes Meron

 

Now the queue has data having equal priority and dequeue operation deletes the front element like in the case of ordinary queues.

 

Dequeue()- deletes Abebe Dequeue()- deletes Alemu

Thus, in the above example the implementation of the dequeue operation need to be modified.

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Object Oriented Programming and Data Structure : Linear Data Structures : Priority Queue |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.