Next: Stack Up: Edge Previous: Edge

### Queue

Instances of the Queue class are singly-linked lists restricted to FIFO (``first in, first out'') access. The methods differing from those of Deque (which are inherited) are listed below.

1. Creation

Queue<Item> | q;

Create an empty Queue. O(1)

Queue<Item> | q2(q);

Create an empty queue and initialize it with the elements of q such that the elements of each Queue are in the same order. O(n)

2. Operations

Item | front ()

Returns the head of the Queue, without removing it.

Item | dequeue ()

Returns the head of the Queue and removes it.

void | enqueue (Item& passed_item)

Appends passed_item to the end of Queue.

void | insert (Item& item)

Calls enqueue(). This method is overrides the virtual method of the same name in Deque.

Next: Stack Up: Edge Previous: Edge