Stack data structures are used for storing collection of data where order in which data is arriving is important. In Stack, insertion, and deletion both happened from the same end which is known as “Top”.
The data which is arrived last will be deleted first in Stack.
This data ordering is called as Last in First out or LIFO.
Properties
- Insertion and Deletion both happened from the same end.
- Sequence in which data is arrived is important.
- Data can be accessed in Stack in LIFO (Last in First out) format.
Let’s look into the below diagram to understand how Stack works.
Let’s have a look into some of the most popular and useful topics in Stack data structures.
- Stack basics
- Stack implementation using Arrays
- Generic Stack implementation using Arrays
- Check balanced parenthesis in an expression
- Convert infix to postfix expression
- Evaluate postfix expression
- Find minimum number in a Stack in O(1) time
- Reverse a Stack
- Check if Linked List is Palindrome
- Implement two Stacks in an array
- Implementation of Queue using Stack