Design Circular Queue — interactive algorithm visualization
Medium · Ring Buffer · time O(1) · space O(k)
A fixed-capacity buffer with head/rear indices that wrap around. Enqueue and dequeue in O(1) without shifting.
Example input: capacity = 3, ops = [enq, enq, enq, deq, enq]
Step through a verified execution trace - every step shows the real state, the invariant that keeps the algorithm correct, and asks you to predict what happens next.
Solve Design Circular Queue in the editor · All 16 visualizations
Previous: Sliding Window Maximum · Next: Binary Tree Inorder