Stack is a linear data structure
which follows a particular order in which the operations are
performed. Order is LIFO(Last In First Out) or FILO(First In Last
Out)
Three main operations of a stack are :
- Push
- Pop
- Peek or Top
![]() |
Stack |
Push
The
Push
Operation pushes an element into the stack.
Pop
Pop
operation removes the top most element in the stack.
Peek
Peek
or
top operation returns the top most value of the stack.
To
understand stack, you can assume a pile of books placed one over the
other.To get the last book in the stack, one needs to take away all
the books before the last book.
Applications of Stack
Stack can be implemented in two different ways:
The implemented codes are carried out into separate blogs in the above given links.
More stack related blogs
More stack related blogs