Skip to content

Implementing a Queue - Resizing Array

Similar in concept to the resizing array in a stack to simplify the process we would essentially break down the process with the bellow pseudo code.

  1. use an array to store our items lets say q[]
  2. our enqueue() function would add new items at q[tail]
  3. our dequeue() function would remove items from q[head]
  4. We would update our head and tail according to a modulo of our capacity
  5. that would in turn be amortizing and adding the resizing array to our client.