- Forward


Priority Queues
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Motivation
Back SMYC Forward
  • An Observation:
    • In some queueing applications, elements are not ordered based on when they arrive but on their priority
  • A Relevant ADT:
    • The Priority Queue
The Priority Queue ADT
Back SMYC Forward

    PriorityQueue
    Values: Elements of any type.
    Operations:
    Name/Operator Arguments Returns
    Constructor A new instance.
    dequeue The element with highest priority
    enqueue
    element The element to add to the priority queue
    priority The priority of the element

Possible Implementations
Back SMYC Forward
  • A Collection of Queues:
    • Works well if you know all of the priorities and they are integer-valued
  • A d-Heap:
    • Works well in general
There's Always More to Learn
Back -