×
Home Discussions Write at Opengenus IQ
×
  • DSA Cheatsheet
  • HOME
  • Track your progress
  • Deep Learning (FREE)
  • Join our Internship 🎓
  • RANDOM
  • One Liner

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

Next Greater Frequency Element

This problem involves combining the concepts of frequency counting and stack-based processing to efficiently determine the next element with a higher frequency for each element in the array.

Kavya Mothukuri
Algorithms

Next Greater Element using Stack

Given an array of integers, arr, of length N. The task is to find the Next Greater Element (NGE) for each element in the array.

Kavya Mothukuri
Stack

Stack Data Structure in JavaScript

In this article at OpenGenus, we will explore the stack data structure in JavaScript, understand its underlying principles, and learn how to implement and utilize stacks effectively.

Mizbaul Haque Maruf Mizbaul Haque Maruf
Java

Stack in Java using OOP concepts + Generics

In this article at OpenGenus, we will explore how to implement a stack using array in Java using OOP concepts and Generics.

Hiten Samalia Hiten Samalia
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
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

Implementing a Stack using an Array and Linked list

Stack is a linear data structure following LIFO (Last in First out) order and can be implemented using Array or Linked List as an internal data structure.

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
OpenGenus IQ © 2025 All rights reserved â„¢
Contact - Email: team@opengenus.org
Primary Address: JR Shinjuku Miraina Tower, Tokyo, Shinjuku 160-0022, JP
Office #2: Commercial Complex D4, Delhi, Delhi 110017, IN
Top Posts LinkedIn Twitter
Android App
Apply for Internship