previous | index | next

Circular Queues

Q: What should happen when the tail of the queue reaches the end of the vector and more items need to be enqueued?

Before an enqueue operation:

A: They should be added where former heads have been removed. That is, the tail should "wrap around" to the beginning of the vector.

After the enqueue operation:


previous | index | next