Stack Data Structure

Recent Articles
Topic :

Introduction :

  1. Introduction to Stack
  2. Stack in C++ STL
  3. Stack Class in Java

Design and Implementation :

  1. Implement Queue using Stacks
  2. Design and Implement Special Stack Data Structure | Added Space Optimized Version
  3. Implement two stacks in an array
  4. Implement Stack using Queues
  5. Design a stack with operations on middle element
  6. How to efficiently implement k stacks in a single array?
  7. How to create mergable stack?
  8. Design a stack that supports getMin() in O(1) time and O(1) extra space
  9. Implement a stack using single queue
  10. How to implement stack using priority queue or heap?
  11. Create a customized data structure which evaluates functions in O(1)

Standard Problems based on Stack

  1. Infix to Postfix Conversion using Stack
  2. The Stock Span Problem
  3. Check for balanced parentheses in an expression
  4. Next Greater Element
  5. The Celebrity Problem
  6. Expression Evaluation
  7. Evaluation of Postfix Expression
  8. Iterative Tower of Hanoi

Operations on Stack

  1. Reverse a stack using recursion
  2. Sort a stack using recursion
  3. Sort a stack using a temporary stack
  4. Reverse a stack without using extra space in O(n)

Misc :

  1. Iterative Postorder Traversal | Set 1 (Using Two Stacks)
  2. Iterative Postorder Traversal | Set 2 (Using One Stack)
  3. Merge Overlapping Intervals
  4. Largest Rectangular Area in a Histogram | Set 2
  5. Print ancestors of a given binary tree node without recursion
  6. Reverse a string using stack
  7. Program for Tower of Hanoi
  8. Find maximum depth of nested parenthesis in a string
  9. Find maximum of minimum for every window size in a given array
  10. Length of the longest valid substring
  11. Iterative Depth First Traversal of Graph
  12. Minimum number of bracket reversals needed to make an expression balanced
  13. Check if a given array can represent Preorder Traversal of Binary Search Tree
  14. Form minimum number from given sequence
  15. Find if an expression has duplicate parenthesis or not
  16. Find maximum difference between nearest left and right smaller elements
  17. Find next Smaller of next Greater in an array
  18. Find maximum sum possible equal sum of three stacks
  19. Count natural numbers whose all permutation are greater than that number
  20. Delete consecutive same words in a sequence
  21. Decode a string recursively encoded as count followed by substring
  22. Bubble sort using two Stacks
  23. Pattern Occurrences : Stack Implementation Java
  24. Iterative method to find ancestors of a given binary tree
  25. Stack Permutations (Check if an array is stack permutation of other)
  26. Tracking current Maximum Element in a Stack
  27. Check mirror in n-ary tree
  28. Reverse a number using stack
  29. Reversing the first K elements of a Queue
  30. Reversing a Queue
  31. Check if stack elements are pairwise consecutive
  32. Spaghetti Stack
  33. Interleave the first half of the queue with second half
  34. Remove brackets from an algebraic string containing + and – operators

Quick Links :

Company Wise Coding Practice    Topic Wise Coding Practice