Patient arrival
Data / Knowledge library
Priority Queue
Removes items according to priority rather than arrival time
Why learn Priority Queue?
It supports scheduling, graph search, and event simulation
The problem it solves
It selects the most urgent pending item efficiently
Where it came from
Priority Queue is a data structure that removes items according to priority rather than arrival time. Its guarantees and tradeoffs depend on the concrete implementation and operating context.
Build your understanding
Work through these exercises in order. Try the task before opening a reference.
- Define Priority Queue and distinguish it from a neighboring concept.
- Choose a realistic task where Priority Queue is appropriate.
- Identify a failure mode caused by misusing Priority Queue.
- Interpret a small design or result involving Priority Queue.
- Explain one tradeoff or limitation of Priority Queue.
Documentation and sources
- NIST Dictionary of Algorithms and Data Structures (xlinux.nist.gov)
Connect the ideas
Explore next
Real World Example
Emergency Medical Triage System
Emergency room intake departments managing patient flow.
The business problem
Standard first-come, first-served queues cause critical patients to wait behind minor cases, leading to preventable health deterioration.
How this topic solves it
A priority queue implementation allows the system to organize patients by clinical urgency (triage level) rather than arrival time, ensuring the highest-acuity patients are processed first.
- Assign a numerical priority score to each patient upon intake.
- Insert patient records into a binary heap structure based on their score.
- Extract the patient with the highest priority score for the next available physician.
- Maintain the heap property after each extraction to ensure the next most urgent patient is at the root.
Patients enter the system and are sorted by urgency into a priority queue before being routed to medical staff.
Assign priority score
Heap-based storage
Treatment
- Intake → Arrival → Triage
- Triage → Insert(score) → Priority Queue
- Priority Queue → Extract-Max → Physician
Expected business outcome
Improved patient safety and reduced wait times for critical cases.
Limitations and checks
The primary limitation is that low-priority patients may suffer from 'starvation' if high-priority patients continue to arrive, which can be checked by monitoring the maximum wait time of the lowest-priority records.