Size a queue for its busiest moment

A server's queue initially holds 7 waiting requests. Its capacity is the maximum number of waiting requests it can store. Requests already removed for processing do not occupy queue space.


The following batches occur in the stated order. Each batch finishes before the next begins, and there are no other arrivals or removals:

  1. Enqueue 8 requests.
  2. Dequeue 6 requests.
  3. Enqueue 11 requests.
  4. Dequeue 9 requests.
  5. Enqueue 5 requests.

What is the minimum fixed capacity that allows every enqueue to succeed without discarding a request or resizing the queue? Answer in requests, as an exact integer.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Queues Questions: