Skip to content

Priority Queue

Introduction

A priority queue is an abstract data type similar to a regular queue or stack abstract data type. Each element in a priority queue has an associate priority. In a priority queue, elements with high priority are served before elements with low priority.

Priority Queue vs. Heaps

  • A priority queue is an abstract data type like a list or a map.
  • Heaps are data structure that can be used to implement priority queue.

Just as list (an abstract data type) can be implemented with a linked list or with an array (data structure). A priority queue can be implemented with a heap or another method such as an ordered array.

References