Data Structures19 sections · 729 units
Open in Course

Vocabulary - Priority Queue

Abstract interface

A priority queue is an abstract data type that supports:

  • Insert an element with a priority
  • Remove and return the highest priority element

Heaps are the standard implementation. "Highest priority" can mean smallest (min-heap) or largest (max-heap). In C++: priority_queue (max-heap by default) In Python: heapq module (min-heap) In Java: PriorityQueue (min-heap by default)