Implement Stack using Arrays
00:00
TCSWiproInfosys
Implement a Stack data structure using an array. Support push, pop, peek, isEmpty, isFull with overflow/underflow handling.
Examples
Input → Ex1: push(1),push(2),peek()=2,pop()=2,peek()=1
Output →
Input → Ex2: isEmpty()=True,push(5),isEmpty()=False
Output →
Input → pop() on empty
Output → underflow error