Definition

  • A variation of the normal queue ADT, where items are also given a priority/rank
  • Priority queues can either be minimum or maximum:
    • Minimum PQueues sort elements with the lower priority first
    • Maximum PQueues sort elements with the higher priority first
  • The same operations of the queue apply here, such as enqueue, dequeue, etc.

Signature

name PQueue; 
import element; 
ops:
	newPQueue : → PQueue; 
	enqueue : PQueue × element × integer → PQueue; 
	head : PQueue → element; 
	dequeue: PQueue → PQueue; 
	isFull : PQueue → boolean; etc.