Definition

  • A collection of items accessed in First In First Out (FIFO) order
  • Only the front can be viewed (similar to stacks)
  • Adding items is referred to as enqueuing
  • Removing items is referred to as dequeuing
  • The first item that was added to a queue is also the first item to leave it

Signature

name queue; 
import elem, boolean; 
ops:
	newQueue : → queue; 
	enqueue : queue × elem → queue; 
	dequeue : queue → queue; 
	front : queue → elem; 
	isEmpty : queue → boolean;
	etc.