Array Implementation of Queue (original) (raw)

Last Updated : 31 Jan, 2026

In Queue insertions happen at one end, but removals happen from the other end. So the array implementation is not going to be straightforward like stack where we insert and remove from the end.

**Simple Array implementation

For implementing the queue, we only need to keep track of two variables: front and size. We can find the rear as front + size - 1.

Please refer Simple Array implementation of Queue for implementation.

**Operations **Complexity
Enqueue (insertion) O(1)
**Deque (deletion) **O(n)
Front (Get front) O(1)
Rear (Get Rear) O(1)
IsFull (Check queue is full or not) O(1)
IsEmpty (Check queue is empty or not) O(1)

**Circular Array Implementation

We can make all operations in O(1) time using circular array implementation.

Please refer **Circular Array implementation Of Queue for details of implementation

**Operations **Complexity
Enqueue (insertion) O(1)
**Deque (deletion) **O(1)
Front (Get front) O(1)
Rear (Get Rear) O(1)
IsFull (Check queue is full or not) O(1)
IsEmpty (Check queue is empty or not) O(1)