QUEUES · CIRCULAR
Indices wrap with % N, so freed slots are reused — nothing wasted.
rear = (rear + 1) % N, then write.
Read, then front = (front + 1) % N.
(rear + 1) % N == front — why one slot stays empty.