Priority queue
A queue where what comes out isn't the first to arrive but the highest-priority one. It's almost always built with a heap.
Example
If tasks with priority 2, 9 and 5 arrive, the 9 comes out first. Adding and removing cost about 20 steps with 1 million tasks.
Test yourself: Priority queue
Heaps
What comes out of a priority queue first?
If tasks with priority 2, 9 and 5 arrive, the 9 comes out first, even though it arrived 2nd.
0/1
â–¶ Play