Question - What operations can be performed on a stack?
Answer -
Mainly the following operations are performed on a stack:
- Push operation: To add an item to the stack. If the stack is complete, then it is in an overflow condition.
- Pop operation: It is used to remove an item from the stack. If it's an empty stack, then it is in underflow condition.
- isEmpty operation: If the stack is empty returns true, else false.
- Peek or Top operation: This returns the top element of the stack.