The simplest queue implementation — elements enter at the rear and leave from the front, stored in a one-dimensional array.
Once the rear pointer reaches the end of the array, no more items can be added — even if spaces at the front have been freed by dequeue operations. This wasted space is the main limitation.
Index 0 is now wasted space — it cannot be reused in a linear queue.
Try enqueue and dequeue operations yourself. Watch the front and rear pointers move.
PROCEDURE Enqueue(Queue, Rear, MaxSize, Item)
IF Rear >= MaxSize - 1 THEN
OUTPUT "Queue is full"
ELSE
Rear ← Rear + 1
Queue[Rear] ← Item
ENDIF
ENDPROCEDURE