What is stack?
A real-world stack allows operations at one end only For example We can place and remove a card or plate from the top the stack only Likewise, Stack ADT(Abstract data type) allows all data operations at one end only, we can only access the Top element of a stack.
Some important points.
- It is a type of linear data structure.
- It follows LIFO (Last in First out) property.
- it has only one pointer TOP that points the last and top most element of stack.
- Insertion and Deletion in stack can only be done from TOP only.
- Insertion in stack is also known as a PUSH operation.
- Deletion from stack is also known as POP operation in stack.
Stack is a linear data structure which follows a particular order in which the operations are performed. The order may be LIFO(last in first out).
Mainly the following three basics operations are performed in the stack.
- PUSH:Adds an item in the stack. if the stack is full,then it is said to be an Overflow condition.
- POP:Remove an item from stack. The items are popped in the reversed order in which they are pushed.If the stack is empty,then it is said to be an Underflow condition.
- PEEK:Return top elements of stack.
- Stack implementation using Array.
- Stack implementation using Link List.