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) or FILO(First In Last Out). Mainly the following three basic 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: Removes an item from the 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 or Top: Returns top element of stack.
- isEmpty: Returns true if stack is empty, else fals.
- Introduction to Stack
- Infix to Postfix Conversion using Stack
- Evaluation of Postfix Expression
- Reverse a String using Stack
- Implement two stacks in an array
- Check for balanced parentheses in an expression
- Next Greater Element
- Reverse a stack using recursion
- Sort a stack using recursion
- The Stock Span Problem
- Design and Implement Special Stack Data Structure
- Implement Stack using Queues
- Design a stack with operations on middle element
- How to efficiently implement k stacks in a single array?
- Iterative Tower of Hanoi
- Length of the longest valid substring
- Find maximum of minimum for every window size in a given array
- Check if a given array can represent Preorder Traversal of Binary Search Tree
- Minimum number of bracket reversals needed to make an expression balanced
- Iterative Depth First Traversal of Graph
- How to create mergable stack?
- Print ancestors of a given binary tree node without recursion
- Expression Evaluation
- Largest Rectangular Area in a Histogram | Set 2
- The Celebrity Problem
- Iterative Postorder Traversal | Set 2 (Using One Stack)
- Iterative Postorder Traversal | Set 1 (Using Two Stacks)
- Implement a stack using single queue
- Design a stack that supports getMin() in O(1) time and O(1) extra space