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.

Popular Articles on Stack

  1. Introduction to Stack
  2. Infix to Postfix Conversion using Stack
  3. Evaluation of Postfix Expression
  4. Reverse a String using Stack
  5. Implement two stacks in an array
  6. Check for balanced parentheses in an expression
  7. Next Greater Element
  8. Reverse a stack using recursion
  9. Sort a stack using recursion
  10. The Stock Span Problem
  11. Design and Implement Special Stack Data Structure
  12. Implement Stack using Queues
  13. Design a stack with operations on middle element
  14. How to efficiently implement k stacks in a single array?
  15. Iterative Tower of Hanoi
  16. Length of the longest valid substring
  17. Find maximum of minimum for every window size in a given array
  18. Check if a given array can represent Preorder Traversal of Binary Search Tree
  19. Minimum number of bracket reversals needed to make an expression balanced
  20. Iterative Depth First Traversal of Graph
  21. How to create mergable stack?
  22. Print ancestors of a given binary tree node without recursion
  23. Expression Evaluation
  24.  Largest Rectangular Area in a Histogram | Set 2
  25. The Celebrity Problem
  26. Iterative Postorder Traversal | Set 2 (Using One Stack)
  27. Iterative Postorder Traversal | Set 1 (Using Two Stacks)
  28. Implement a stack using single queue
  29. Design a stack that supports getMin() in O(1) time and O(1) extra space
  30. More…


Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Company Wise Coding Practice    Topic Wise Coding Practice