The priority queue
As queues are largely applied in Computer Science and also in our lives, there are some modified versions of the default queue we implemented in the previous topic.
One modified version is the priority queue. Elements are added and removed based on a priority. An example from real life is the boarding line at the airport. First class and business class passengers have priority over coach class passengers. In some countries, elderly people and pregnant women (or women with newborn children) also have priority for boarding over other passengers.
Another example from real life is the patient's waiting room from a hospital (emergency department). Patients that have a severe condition are seen by a doctor prior to patients with a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access