Applications of stack

In this tutorial, we learn basic about stack then I will come to main topic applications of stack, how it impacts our real life, in computer science and valid applications of stack is recursion.

A stack is a linear data structure in which objects are just like a pile of the CD on CD spindle(whose one end is closed and other is open) kept on top of each other. Stack work on LIFO(Last IN First OUT) order.

below I mention an image to easily understand push and pop operation of stack. 

applications of stack real life, in computer science and valid applications of stack is recusion

Applications of stack in real life

Reversal String

Stack can be used in reverse string. We push elements into the stack and pop elements from the stack. then, print the pop element one by one.

Parenthesis Matching

It is used to checking the parenthesis in the program i.e. matching of left and right parenthesis. 

Syntax Parsing 

Compilers must parse source code to be able to translate it into low-level code.

Expression Evaluation 

It can be used to evaluate postfix, prefix and infix expression.

Expression Conversion 

It is used to converting one expression into another.

Valid application of stack

Function Call

Stack can be used in a function call.

Mathematical Puzzle

Real-life in to solve the Tower of Hanoi Puzzle. 

Basic about Tower of Hanoi

These are some applications of stack in 
real life and in computer science. Comment below if you have any problem in the above article do not hesitate.

Happy Coding 😊

Share this

0 Comment to "Applications of stack"

Post a Comment