The queue abstract data type is defined by the following structure and operations. A queue is structured is an ordered collection of items which are added at one end, called the “rear,” and removed from the other end, called the “front.” Queues maintain a FIFO ordering property.

Element insertion is restricted to the back of sequence as queue follows FIFO principal.

The Queue abstract data type (ADT) Supports the following two update methods:

enqueue(): adds a new item to the rear of the queue. It needs the item and returns nothing.

dequeue(): removes the front item from the queue. It needs no parameters and returns the item. The queue is modified.

The queue ADT also includes the following accessor methods:

isEmpty(): tests to see whether the queue is empty. It needs no parameters and returns a boolean value.

size(): returns the number of items in the queue. It needs no parameters and returns an integer.

first(): returns the first element of the queue, without removing it.