Module 7 · priority_queue: The Biggest One Comes Out First
When to Use priority_queue, and When a Sort or a set Is Better
Free with an accountReading
Kenji pushes a million sensor readings into a priority_queue, only to print them all, largest first, once. Maria keeps her lab's task list in a vector, and before every take she scans it for the most urgent task. Both programs print the right answer. Amara asks each of them one question: what did the job need?
Checking what this lesson needs for you…
What is inside When to Use priority_queue, and When a Sort or a set Is Better
- Four questions about the job
- The comparison chart
- The decision flowchart
- Kenji's million readings: one sort against the heap
- Values that keep arriving: four containers raced
- Both ends at once
- When not to use a priority_queue