# Stack

The stack is a data structure used to store the collection of objects. The object inserted using push and removed using pop operations with last-in-first-out (LIFO) principle.

Stack data structure uses in application function call stack, convert an expression from the different format and more. The image shows the user can remove the stone from the top of the stack and add stone to the top.

Stack section explains how to implement the stack and various application related problems which use stack operation

1 Stack Implementation

Stack data Structure used to store the objects in last in first out principle (LIFO). Stack implemented using array and in build collection or STL functions

2 Balance symbol

Read the string from user input and validate the symbols in that strings are balanced or not balanced using the stack. Ex {[()]} — Balanced symbol. {(]} — Not balanced symbol.

3 Infix to Postfix

The infix notation places the operators in between the operands. The postfix notation place operators after their operands. Write a program convert from infix notation to postfix notation. Ex Infix (5 + 3) * 12 / 3 Postfix: 5 3 + 12 * 3 /

4 Evaluate postfix or RPN

Evaluate postfix or Reverse Polish notation is a notation in which every operator follows all of its operands. Program to evaluate postfix notation using stack

5 3 stacks in One array

Program to implement 3 stacks using one array.

6 Find in Spans

Find a maximum span of numbers in a given array using stack.

7 Evaluate infix notation using Shunting-yard algorithm

The infix notation place operators in between the operands.write program to evaluate infix expression using the shunting-yard algorithm. Shunting-yard algorithm is a method for parsing mathematical expressions specified in infix notation.

8 Print BST

Print the Binary search Tree using stack.

9 Tower Of Hanoi

Tower Of Hanoi is a mathematical game which consists three rods. The rods have the disk with the different size. The objective of the puzzle is to move the entire stack to another rod.

10 stack sorting

Implement the sorted stack. If the element removed from stack, it should remove maximum priority element.

11 Postfix to infix

Write a program convert from Postfix notation to infix notation using stack. Ex Postfix: 5 3 + 12 * 3 / Infix (5 + 3) * 12 / 3

12 evaluateInfix

The infix notation place operators in between the operands. Write a program to evaluate infix expression using the stack.

13 MyDecimalToBinary

Write a program to convert Decimal number to binary using stack. Get decimal input and print the Binary numbers

14 Reverse String

Write a program to reverse the string using the stack

15 dynamic stack

Write a program for the dynamic stack. If the element reaches the maximum size, extend the stack size and add the element.

16 PostfixtoInfix

The infix notation place operators in between the operands. The postfix notation place operators after their operands. Write a program convert from Postfix to infix

*Originally published at **careerdrill.com**.*