previous | index | next

Shifting Queue Elements

Suppose four items have been enqueued and it is time to dequeue. To maintain the invariant, items have to be shifted down:

If the queue is large, dequeuing would be a costly operation


previous | index | next