A stack is an ordered list in which insertion and deletion are done at one end, called top. The last element inserted is the first one to be deleted. Hence, it is called the Last in First out (LIFO) or First in Last out (FILO) list.
When an element is inserted in a stack, the concept is called push, and when an element is removed from the stack, the concept is called pop. Trying to pop out an empty stack is called underflow and trying to push an element in a full stack is called overflow.
- Push (data): Inserts data onto stack.
- Pop(): Removes and returns the last inserted element from the stack.
- Top(): Returns the last inserted element without removing it.
- Size(): Returns the number of elements stored in the stack.
- IsEmptyStack(): Indicates whether any elements are stored in the stack or not.
- IsFullStack(): Indicates whether the stack is full or not.