DSA: Stack - Questions
Jayaprasanna Roddam
Posted on October 9, 2024
1. Stack Basics
· Implementing a Stack Using Arrays
· Implementing a Stack Using Linked Lists
· Implementing a Stack Using Two Queues
· Implementing a Stack Using a Single Queue
· Stack Operations (Push, Pop, Peek)
· Implementing a Min Stack (Get Minimum in O(1) Time)
· Implementing a Max Stack (Get Maximum in O(1) Time)
· Implementing a Stack Using Two Stacks
· Implementing a Stack Using Recursion
· Stack Implementation Using Dynamic Arrays
2. Infix, Prefix, and Postfix Expressions
· Converting Infix to Postfix
· Converting Infix to Prefix
· Converting Postfix to Infix
· Converting Prefix to Infix
· Evaluating a Postfix Expression
· Evaluating a Prefix Expression
· Validating an Infix Expression
· Parenthesis Matching (Balanced Parentheses)
· Implementing Shunting Yard Algorithm for Expression Parsing
· Converting Infix to Postfix with Associativity and Precedence Handling
3. Advanced Stack Operations
· Design a Stack that Supports GetMin, GetMax, and GetMedian
· Implementing a Two-Stack Queue
· Design a Stack with Increment Operation
· Implementing a Stack Using Deque
· Implementing Special Stack Operations (Double Push, Double Pop)
· Building a Stack from Scratch Without Using Built-In Data Structures
· Implement a Stack with Dynamic Resizing
· Implement a Stack That Supports Middle Element Access
· Implement Stack Sorting Using Recursion
· Implement a Custom Stack with Customized Push/Pop Rules
4. Stack-Based Problem-Solving
· Next Greater Element to the Right
· Next Greater Element to the Left
· Next Smaller Element to the Right
· Next Smaller Element to the Left
· Stock Span Problem
· Largest Rectangle in Histogram
· Trapping Rain water Problem
· Simplify Directory Path (Unix Style Path Simplification)
· Evaluate Reverse Polish Notation
· Validating Stack Sequences
5. Stack and Recursion
· Reverse a Stack Using Recursion
· Sort a Stack Using Recursion
· Insert an Element at the Bottom of a Stack Using Recursion
· Finding Maximum Depth of Nested Parentheses
· Decode a String with Nested Patterns (e.g., "3[a2[c]]" → "accaccacc")
· Removing K Digits to Get the Smallest Number
· Checking Redundant Parentheses in an Expression
· Flattening Nested Lists (Nested List Weight Sum)
· Recursive Depth Calculation Using Stack
· Implement an Algorithm for the Nearest Smaller Values (Monotonic Stack)
Posted on October 9, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.