Implement a Generic Stack
HANDS-ON PRACTICE
Implement a Generic Stack
Wrap the dynamic array built earlier, or a standard sequential container, in a generic stack. Do not reimplement the backing array.
- Provide size, empty, and clear operations.
- Implement push, pop, and peek/top while preserving FILO order.
- Define explicit underflow behavior for an empty stack.