Stack Interview Questions | Practice Problems

A stack is an abstract data type that serves as a collection of elements, with two principal operations: push, which adds an element to the collection, and pop, which removes the most recently added element that was not yet removed. The order in which elements come off a stack gives rise to its alternative name, LIFO (for last in, first out). Additionally, a peek operation may give access to the top without modifying the stack.

Considered as a linear data structure, the push and pop operations occur only at one end of the structure, referred to as the top of the stack. This makes it possible to implement a stack as a singly linked list and a pointer to the top element.

A stack may be implemented to have a bounded capacity. If the stack is full and does not contain enough space to accept an entity to be pushed, the stack is then considered to be in an overflow state. The pop operation removes an item from the top of the stack.

Below is the list of commonly asked interview questions that uses stack data structure-

  1. Stack Implementation
  2. Stack Implementation using Linked List
  3. Check if given expression is balanced expression or not
  4. Find duplicate parenthesis in an expression
  5. Evaluate given postfix expression
  6. Decode the given sequence to construct minimum number without repeated digits
  7. Inorder Tree Traversal | Iterative & Recursive
  8. Preorder Tree Traversal | Iterative & Recursive
  9. Postorder Tree Traversal | Iterative & Recursive
  10. Find ancestors of given node in a Binary Tree
  11. Check if two given binary trees are identical or not | Iterative & Recursive
  12. Reverse given text without reversing the individual words
  13. Find all binary strings that can be formed from given wildcard pattern
  14. Iterative Implementation of Quicksort
  15. Depth First Search (DFS) | Iterative & Recursive Implementation
  16. Invert given Binary Tree | Recursive and Iterative solution
  17. Print leaf to root path for every leaf node in a binary tree


Thank you for being with us. 🙂


Leave a Reply

Notify of