A stack is a linear data structure with an abstract data type that depicts Last in First Out (LIFO) behavior. It can be implemented as an array or LinkedList. We can insert & delete elements in the stack from the top-end only. Inserting elements in the stack is called pushing & deleting elements from the stack is called popping.
Stack defined as a container in which insertion & deletion can be done from one end calls as a top of the stack.
- Kind of abstract data type with a pre-defined capacity
- Follows some order to do insertion & deletion of an element in order of LIFO or FILO
- A Top element can be accessed
- No more flexible
- Manipulation is restricted to the top element of the stack
- push() - Insert element in the stack, an overflow condition occurs when the stack is full
- pop() - Delete an element from the stack, underflow condition occurs when the stack has no element that exists
- isEmpty() - determined if the stack is empty or not
- isFull() - determined if the stack is full or not
- peek() - return the element at peel position
- count() - return the total number of elements available in a stack
- change() - change element on change position
- display() - print all the elements available in the stack