Implement two stacks in a single array
This post will discuss how to implement two stacks in a single array efficiently.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedThis post will discuss how to implement two stacks in a single array efficiently.
Given an infix expression, convert it to the postfix expression. Assume that the infix expression is a string of tokens without any spaces.
Given a stack, recursively reverse it only using its abstract data type (ADT) standard operations, i.e., push(item), pop(), peek(), isEmpty(), size(), etc.
Given a stack, sort it using recursion. The use of any other data structures (like containers in STL or Collections in Java) is not allowed.
This post will implement a queue using the stack data structure. In other words, design a queue that supports enqueue and dequeue operations using standard push and pop operations of the stack.
Write an efficient algorithm to find a binary tree’s preorder traversal from its inorder and postorder sequence without constructing the tree.
Design a stack to support an additional operation that returns the minimum element from the stack in constant time. The stack should continue supporting all other operations like push, pop, top, size, empty, etc., with no degradation in these operations’ performance.
This article covers the stack implementation in Python. A stack is a linear data structure that follows the LIFO (Last–In, First–Out) order, i.e., items can be inserted or removed only at one end of it.
Given a string consisting of opening and closing parenthesis, find the length of the longest balanced parenthesis in it.
This post will discuss how to reverse an array in C++.
This post will discuss how to reverse a string using the stack data structure in C/C++, Java, and Python using explicit stack and call stack.
Design a stack to support an additional operation that returns the minimum element from the stack in constant time. The stack should continue supporting all other operations like push, pop, top, size, empty, etc., without degradation in these operations’ performance.