Stack and Queue C/C++ Programs Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The stack and queue are popular linear data structures with a wide variety of applications. The stack follows LIFO (Last In First Out) principle where the data is inserted and extracted from the same side. On the other hand, the queue follows FIFO (First In First Out) principle, i.e., data is inserted at one side and extracted from the other side. In this article, we will study some of the most common practice problems in C/C++ to improve our understanding of stack and queue data structures. Prerequisite: Stack Data Structure, Queue Data Structure Stack Practice Problems in C/C++The following is the list of C/C++ programs based on the level of difficulty: EasyHow to Reverse a String Using StackImplement Two Stacks in an Array Check for Balanced Brackets in an Expression (Well-formedness)Remove all Duplicate Adjacent Characters from a String Using StackEvaluation of Postfix ExpressionCheck if Two Strings after Processing Backspace Character are Equal or NotExpression Contains Redundant Bracket or NotFind Maximum Depth of Nested Parenthesis in a StringFind the Nearest Smaller Numbers on Left Side in an ArraySort a Stack Using a Temporary StackMediumHow to Reverse a Stack Using Recursion Convert Infix Expression to Postfix ExpressionNext Greater Element (NGE) for Every Element in Given ArrayThe Stock Span ProblemDesign a Stack with Operations on Middle ElementSimplify the Directory Path (Unix Like)Minimum Number of Parentheses to be Added to Make it ValidDesign and Implement Special Stack Data Structure | Added Space Optimized VersionNext Greater Frequency ElementTrapping Rain Water Hard Length of the Longest Valid SubstringForm Minimum Number from Given SequenceLargest Rectangular Area in a Histogram Using StackMaximum Size Rectangle Binary Sub-matrix with All 1sSum of Minimum Elements of All SubarraysCheck if a Triplet of Buildings can be Selected such that the Third Building is Taller Than the First Building and Smaller than the Second BuildingRange Queries for Longest Correct Bracket Subsequence Set | 2Design a Stack which can Give Maximum Frequency ElementFind Maximum of Minimum for Every Window Size in a Given ArrayDesign Custom Browser History Based on Given OperationsQueue Practice Problems in C/C++The following is the list of C/C++ programs based on the level of difficulty: EasyReversing a QueueReversing the First K Elements of a QueueImplement Queue using Two StacksImplement Stack using QueueMinimum Sum of Two Numbers Formed from Digits of an ArrayMaximum Number of Diamonds that can be gained in K MinutesFirst Negative Integer in Every Window of Size KFirst Negative Integer in Every Window of Size KConnect N Ropes with Minimum CostMediumSorting a Queue without Extra SpaceFind the First Circular Tour that Visits All Petrol PumpsDesign a Hit CounterFlood Fill AlgorithmAn Interesting Method to Generate Binary Numbers from 1 to NMinimum Sum of Squares of Character Counts in a Given String after Removing K CharactersInterleave the First Half of the Queue with the Second HalfMinimum Time Required to Rot All OrangesSliding Window Maximum (Maximum of All Subarrays of Size K)HardFind the First Non-repeating Character from a Stream of CharactersSum of Minimum and Maximum Elements of all Subarrays of Size KAn Interesting Method to Generate Binary Numbers from 1 to nSnake and Ladder ProblemFind the First Circular Tour that Visits all Petrol PumpsShortest Path in a Binary Maze Create Quiz Comment R rahulsharmagfg1 Follow 0 Improve R rahulsharmagfg1 Follow 0 Improve Article Tags : C++ C Queue Programs C++ Queue Programs Explore C++ BasicsIntroduction to C++3 min readData Types in C++6 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++3 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++12 min readFile Handling in C++8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++6 min readPolymorphism in C++5 min readEncapsulation in C++3 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL2 min readIterators in C++ STL10 min readC++ STL Algorithm Library3 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like