Skip to content

Fixed-Capacity Generic Buffer

Published 3 October 2026

Onsite Round 4 — Fixed-Capacity Generic Buffer

The fourth round asked me to design a generic data structure with FIFO behavior and constant-time insertion and removal. Memory needed to be allocated when the class was instantiated rather than growing dynamically during use.

When the structure reached capacity, inserting another item needed to overwrite the oldest stored value.

Implementation

After discussing the data structure, I was asked to implement a fixed-capacity generic buffer similar to CircularBuffer<T, 5>.

Required Operations

The class needed to support push(), pop(), and print() operations.