<DS/>DS_VISUALIZER
FoundationsOOPArraysLinked ListStacksQueuesTreesGraphsHashingStrings
exploreExplore
homechevron_rightTopicschevron_rightQueueschevron_rightCircular Queue
refresh

QUEUES · CIRCULAR

Circular Queue

Indices wrap with % N, so freed slots are reused — nothing wasted.

Choose an operation

loginarrow_outward

Enqueue

rear = (rear + 1) % N, then write.

O(1)O(1)◍ 0/6
logoutarrow_outward

Dequeue

Read, then front = (front + 1) % N.

O(1)O(1)◍ 0/6
warningarrow_outward

Overflow Condition

(rear + 1) % N == front — why one slot stays empty.

O(1)O(1)◍ 0/6