PriorityQueue ADT

  • Describe what Priority Queue is and how it is different from standard Queue.

A Priority Queue is a variation of a standard queue where instead of being a "first-in-first-out" data structure, values come out in order of highest priority.

The "priority" by default is based on the natural ordering of the elements. In some implementations, if priority is the same for two elements, they are removed (dequeued) based on "first come, first serve."

In this chapter, we will explore a very interesting data structure called binary heap that enables us to efficiently implement PriorityQueue ADT.