Implement a fixed-capacity circular buffer (ring buffer) supporting push, pop, peek, isEmpty, isFull, and size in O(
-
time using an array. Define and implement the behavior when pushing to a full buffer (either overwrite the oldest element or reject the push—choose and document). Provide iteration over current elements in logical order. Discuss how you would extend it to a thread-safe version with optional blocking push/pop using condition variables, and analyze time/space complexity.