Queue•Easy
Enqueue Operation
Queue Enqueue Operation

The Enqueue operation inserts a new element at the rear (back) of the queue.
Key Rules
- Overflow Check: Before adding a new element, you must verify if the queue has reached its allocated capacity limit. In a linear array queue, this is checked by comparing if
rear >= MAX - 1. If it is full, a Queue Overflow condition occurs, and the enqueue is rejected. - Increment Rear: If space remains, increment the index pointer
rearby 1 to point to the next vacant slot. - Store Value: Place the new element at the newly incremented index
arr[rear].
Linear Queue vs Circular Queue Note
In a standard linear queue, if you enqueue elements until rear reaches MAX - 1, and then dequeue some elements, you still cannot enqueue new elements because the rear pointer is stuck at the end. To solve this, a Circular Queue wraps pointers around using modulo arithmetic.