14Stacks, Queues, and Linked Lists
The Queue Abstract Data Type
• The queue supports two fundamental methods:
- enqueue(o): Insert object o at the rear of the queue
Input: Object; Output: none
- dequeue(): Remove the object from the front of
the queue and return it; an error
occurs if the queue is empty
Input: none; Output: Object
• These support methods should also be defined:
- size(): Return the number of objects in the
queue
Input: none; Output: integer
- isEmpty(): Return a boolean value that indicates
whether the queue is empty
Input: none; Output: boolean
- front(): Return, but do not remove, the front
object in the queue; an error occurs if
the queue is empty
Input: none; Output: Object