Priority Queue

Motivation

  • sink or swim based on priority
  • printer queue
  • event scheduler
  • traffic lights and a fire truck....

Definition

A queue in which elements are given an additional key indicating priority.

Attributes

  • parent
  • left
  • right
  • priority

Operations

  • push(item)
  • pop()
  • peek()