A priority queue is an abstract data type which is like regular queue or stack data structure,
but where additionally each element has a priority attached to it.
In a priority queue an element with high priority is served before an element with low priority.
If tow elements have the same priority, they're served according to the order in which they were
added to the queue.
While priority queues are mostly implemented with heaps, they're distinct from heaps.
A priority queue is an abstract concept like a "List" or a "Map", just like a list can be implemented
with linked list or an array, a priority queue can be implemented with a heap or a verity of other
methods such as an unordered array
suppose in a class of students you want to get the next best student or the next worst student
based on the marks they got in a test,
Priority queue can do that without going through the entire list of students one by one
While priority queues are mostly implemented with heaps, they're distinct from heaps. A priority queue is an abstract concept like a "List" or a "Map", just like a list can be implemented with linked list or an array, a priority queue can be implemented with a heap or a verity of other methods such as an unordered array
Used case
Files: PriorityQueue | Test