×
Home Discussions Write at Opengenus IQ
×
  • Track your progress
  • Deep Learning Projects
  • Python Projects
  • Join our Internship 🎓
  • RANDOM
  • 100+ Graph Algorithms
  • 100+ DP Problems
  • 50+ Linked List Problems
  • 50+ Array Problems
  • One Liner
  • 50+ Binary Tree problems
  • Home
  • Rust Projects

Stack

Stack is a common yet very useful data structure which is defined as LIFO (Last In First Out). This is the list of problems and topics on Stack at OpenGenus.

Algorithms

Stack vs Queue [Differences]

In this article, we will be discussing about "Stack vs Queue" in detail.

Uddeshya Raj
Algorithms

Reverse a Queue using Stack

In this article, we have explored how to reverse a Queue using Stack data structure.

Rahul Kumar Rahul Kumar
Time Complexity

Time and Space Complexity of Stack

In this article, we will explore about various operations on Stack Data Structure and the Time and Space Complexity of each operation for various cases like Best case, Average case and Worst case.

Mohd Ehtesham Uddin Qureshi Mohd Ehtesham Uddin Qureshi
Algorithms

Delete middle element of Stack

In this article, we discuss an iterative and recursive approach to delete the middle element of a stack.

Erick Lumunge
Algorithms

Merge Intervals problem

In this article, we will learn how to solve the Merge Overlapping Intervals problem in most efficient and easy to understand method with the help of stack. We do this in linear time O(N).

Kartik Keyan Kant Kartik Keyan Kant
Algorithms

Implement K stacks in one array

In this article, we have present two approaches to design K stacks in one array. The challenge is to efficiently store the elements to use all available space in the array and maintain the time complexity of stack operations.

Vikram Shishupalsingh Bais Vikram Shishupalsingh Bais
Algorithms

Invert / Reverse a Binary Tree [3 methods]

Inverting a binary tree is one of the most common questions asked in the interviews of many companies. In this article, we will see in detail as to how one can understand and tackle this task of inverting a binary tree using recursion, stack and queue.

Sanjana Babu Sanjana Babu
Algorithms

Arithmetic Expression Evaluation using Stack

We have explained how an Arithmetic Expression (like 2 * 3 + 4) is evaluated using Stack. We have presented the algorithms and time/ space complexity.

Tushti
Algorithms

Bubble Sort using Two Stacks

We have explored the algorithm to perform Bubble Sorting Algorithm using Two Stacks and sort a given array.

Aaliyah Ahmed
Algorithms

Shortest Unsorted Continuous Subarray

We have solved the problem "Shortest Unsorted Continuous Subarray" and explained the logic behind it and what are the different methods (like Monotonic Stack) we can use to solve it efficiently.

Adith Narein T Adith Narein T
Algorithms

Remove K digits to make smallest number

We will be solving the problem of removing K digits from a given number to form the smallest number possible without changing the order of the original number. We will use the idea of Monotonic Stack

Vansh Pratap Singh Vansh Pratap Singh
Algorithms

Insert element at bottom of Stack [Explained]

In this article, we have explained how to insert an element at the bottom of Stack using standard stack operations like push and pop. We have covered two approaches: iterative and recursive.

Mallika Dey
Algorithms

Make String Stable [using Stack]

Given a string with opening and closing braces, our problem is to find the minimum number of operations to make the string stable. This can be solved efficiently using Stack.

Sonal Agrawal Sonal Agrawal
Algorithms

132 Pattern Problem [Solved]

In this article, we have explained what is 132 pattern problem and have discussed 3 different approaches to solve it in linear time O(N) where brute force approach takes O(N^3) time.

Vikram Shishupalsingh Bais Vikram Shishupalsingh Bais
Algorithms

Different ways to sort a Queue

We will be discussing 4 different ways to sort a queue. This involves sorting a Queue using auxiliary array, O(1) space, using recursion and using a stack.

Tushti
Algorithms

Implementing two stacks in one array

We will demonstrate how to implement 2 stacks in one array. Both stacks are independent but use the same array. We need to make sure one stack does not interfere with the other stack and support push and pop operation accordingly.

Prnika Bakshi Prnika Bakshi
Algorithms

Reverse first K elements of Queue using Stack

To reverse the first K elements of a queue, we can use an auxiliary stack. We push the first k elements in the stack and pop() them out so and add them at the end of the queue.

Tushti
Algorithms

Reverse a Stack

The objective of this article is to explore various approaches that can be used to reverse the given stack (stack is a linear data structure where insertion and deletion are made at the same end).

Raghavendra Achar C
Algorithms

C program to check whether brackets are Balanced in an Equation

We have developed a C program to check whether brackets are Balanced in an Equation using the Stack data structure and solving it in O(N) time.

Abhiram Reddy Duggempudi Abhiram Reddy Duggempudi
Data Structures

Sort a stack using another stack

In this article, we have explored an algorithm to sort a stack using another stack that is by using stack operations like push and pop only. The time complexity of this approach is O(N^2) and space complexity is O(N).

Roshni Verma
Data Structures

Dynamic Stack

Dynamic Stack, just like Dynamic Array, is a stack data structure whose the length or capacity (maximum number of elements that can be stored) increases or decreases in real time based on the operations (like insertion or deletion) performed on it.

Aarushi Ghadiya
Software Engineering

Initialize Stack in C++ STL

std::stack is a type of container adapter, specifically designed to operate in a LIFO fashion elements can be inserted or removed from only one end

Eashwaran Raghu Eashwaran Raghu
Algorithms

Converting Postfix to Infix using Stack

We have explored an algorithm to convert a Postfix expression to Infix expression using Stack. This takes linear time O(N)

Akshay Gopani Akshay Gopani
C++

Stack in C++ STL

Stack in the STL of C++ is a dynamically resizing container. Stack class is an container adapter. Containers or container classes store objects and data. There are in total seven standard "first-class" container classes and three container adaptor classes and only seven header files

Piyush Rajendra Chaudhari Piyush Rajendra Chaudhari
Data Structures

Implementing Stack using queues in two ways

A stack is based on the principle of Last-in-First-Out(LIFO). It is commonly used abstract data type with two major operations, namely pop and push. Push() and pop() are carried out in the topmost element, which is the item most recently added to the stack. Push operation adds an element to stack

Vaibhav Gupta
OpenGenus IQ © 2023 All rights reserved â„¢ [email: team@opengenus.org]
Top Posts LinkedIn Twitter