Skip to content
Courses
DSA to Development
Get IBM Certification
Newly Launched!
Master Django Framework
Become AWS Certified
For Working Professionals
Interview 101: DSA & System Design
Data Science Training Program
JAVA Backend Development (Live)
DevOps Engineering (LIVE)
Data Structures & Algorithms in Python
For Students
Placement Preparation Course
Data Science (Live)
Data Structure & Algorithm-Self Paced (C++/JAVA)
Master Competitive Programming (Live)
Full Stack Development with React & Node JS (Live)
Full Stack Development
Data Science Program
All Courses
Tutorials
Data Structures & Algorithms
ML & Data Science
Interview Corner
Programming Languages
Web Development
CS Subjects
DevOps And Linux
School Learning
Practice
Build your AI Agent
GfG 160
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
Contests
Accenture Hackathon (Ending Soon!)
GfG Weekly [Rated Contest]
Job-A-Thon Hiring Challenge
All Contests and Events
DSA
Practice Problems
Python
C
C++
Java
Courses
Machine Learning
DevOps
Web Development
System Design
Aptitude
Projects
Sign In
▲
Similar Topics
DSA
22.3k+ articles
Arrays
6.4k+ articles
C++
4k+ articles
Strings
3.2k+ articles
C++ Programs
2.5k+ articles
STL
1.2k+ articles
Data Structures
1.1k+ articles
CPP Examples
700+ articles
Stack
420+ articles
cpp-stack-functions
28 articles
cpp-stack
78 posts
Popular Articles
Recent Articles
Program to insert an element at the Bottom of a Stack
Last Updated: 15 April 2025
Given a stack s containing n integers and an integer x, the task is to insert the element x at the bottom of the stack.Examples:Input:x = 7s
...read more
Stack
Recursion
Data Structures
cpp-stack
cpp-stack-functions
DSA
Preorder, Postorder and Inorder Traversal of a Binary Tree using a single Stack
Last Updated: 18 January 2022
Given a binary tree, the task is to print all the nodes of the binary tree in Pre-order, Post-order, and In-order iteratively using only one
...read more
Tree
Inorder Traversal
Preorder Traversal
PostOrder Traversal
Binary Tree
Stack
Algorithms
Tree Traversals
cpp-stack
DSA
Implementing Backward and Forward buttons of Browser
Last Updated: 29 March 2023
Design the forward and backward buttons of a Browser using Stack Data Structure. If at any instance, the URL does not exist after pressing a
...read more
Stack
Data Structures
cpp-stack
DSA
Similar Topics
DSA
22.3k+ articles
Arrays
6.4k+ articles
C++
4k+ articles
Strings
3.2k+ articles
C++ Programs
2.5k+ articles
STL
1.2k+ articles
Data Structures
1.1k+ articles
CPP Examples
700+ articles
Stack
420+ articles
cpp-stack-functions
28+ articles
Implement Undo and Redo features of a Text Editor
Last Updated: 27 August 2021
Given an array of strings Q[], consisting of queries of the following types:“WRITE X”: Write a character X into the document.“UNDO”:
...read more
Arrays
Strings
Amazon
Stack
Amazon-Question
interview-preparation
Data Structures
cpp-stack
DSA
Check if the two given stacks are same
Last Updated: 01 November 2023
Given two Stacks, the task is to check if the given stacks are same or not.Two stacks are said to be same if they contains the same elements
...read more
Stack
cpp-stack
DSA
Next Smaller Element
Last Updated: 11 February 2025
Given an array, print the Next Smaller Element (NSE) for every element. The NSE for an element x is the first smaller element on the right s
...read more
Arrays
Stack
Searching
cpp-stack
DSA
stack emplace() in C++ STL
Last Updated: 30 May 2023
Stacks are a type of container adaptors with LIFO(Last In First Out) type of working, where a new element is added at one end (top) and an e
...read more
STL
C++
cpp-stack
cpp-stack-functions
stack swap() in C++ STL
Last Updated: 24 July 2024
Stacks are a type of container adaptors with LIFO(Last In First Out) type of work, where a new element is added at one end and (top) an elem
...read more
STL
C++
cpp-stack
cpp-stack-functions
Reverse individual words
Last Updated: 17 March 2025
Given string str, we need to print the reverse of individual words.Examples: Input: Hello WorldOutput: olleH dlroWExplanation: Each word in
...read more
Strings
Amazon
Stack
STL
cpp-string
cpp-stack
cpp-stringstream
DSA
stack::push() and stack::pop() in C++ STL
Last Updated: 11 January 2025
The stack::push() and stack::pop() method in stack container is used to insert and delete the element from the top of stack. They are the me
...read more
STL
CPP-Library
C++
cpp-containers-library
cpp-stack
cpp-stack-functions
stack top() in C++ STL
Last Updated: 14 February 2025
In C++, the std::stack::top() is used to find the top element of the std::stack container. It is a member function of std::stack class defin
...read more
STL
CPP-Library
C++
cpp-containers-library
cpp-stack
cpp-stack-functions
stack empty() and stack size() in C++ STL
Last Updated: 08 April 2025
The std::stack::size() and std::stack::empty() in C++ are built-in functions that are used to provide information about the size of the stac
...read more
STL
CPP-Library
CPP-Functions
C++
cpp-containers-library
cpp-stack
cpp-stack-functions
ZigZag Tree Traversal
Last Updated: 23 September 2024
Given a binary tree, the task is to find the zigzag level order traversal of the tree. In zig zag traversal starting from the first level go
...read more
Tree
Amazon
FactSet
Stack
Queue
cpp-queue
cpp-stack
Traversal
DSA
Number of NGEs to the right
Last Updated: 09 October 2023
Given an array of N integers and Q queries, print the number of next greater elements to the right of the given index element.Examples:Input
...read more
Arrays
Stack
Dynamic Programming
Hash
cpp-stack
DSA
Stack in C++ STL
Last Updated: 28 February 2025
In C++, stack container follows LIFO (Last In First Out) order of insertion and deletion. It means that most recently inserted element is re
...read more
Stack
STL
C++
cpp-containers-library
cpp-stack
cpp-stack-functions
1
2
3
4
5
6
>>
Last
1
2
3
4
5
6
>>
Last
1
2
3
4
>>
Last
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !