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.
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.
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.
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.
Algorithms Stack vs Queue [Differences] In this article, we will be discussing about "Stack vs Queue" in detail.
Algorithms Reverse a Queue using Stack In this article, we have explored how to reverse a Queue using Stack data structure.
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.
Algorithms Delete middle element of Stack In this article, we discuss an iterative and recursive approach to delete the middle element of a stack.
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).
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.
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.
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.
Algorithms Bubble Sort using Two Stacks We have explored the algorithm to perform Bubble Sorting Algorithm using Two Stacks and sort a given array.
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.
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
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.
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.
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.
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.
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.
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.
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).
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.
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.
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).