Queue operations
A queue is first in, first out: values join at the rear and leave from the front. On an array, keep front and size and treat the array as a circle — enqueue writes at (front + size) % n, dequeue moves front forward, and both wrap around past the last index. Nothing ever shifts, so every operation is O(1).
The queue is left at the front (left) and joined at the rear (right), with its array index under each. arr is used as a circle: the queue runs from front for size slots, wrapping past the end.
Time complexity
For a queue in an array of n slots. Nothing ever shifts: front and rear just move forward around the circle. The highlighted row is the operation you are visualizing. GeeksforGeeks: Implement queue using array ↗