Stacks

It stores the list of items in which an item can be added or removed from the list only at end.
It is based on LIFO (Last In First Out) mechanism.

Operations

This includes:
1. push(x) - It pushes the element x in stack .
2. pop() - It will remove the topmost element present in stack .
3. top() - It will point the topmost element in stack .
4. empty() - It will check whether the stacj us empty or not and will return true if its empty else it will return false.

Stack using array implementation


next