0% found this document useful (0 votes)
49 views12 pages

Dsu Presentation

The document describes infix to postfix conversion using a stack. It defines what a stack is, its operations like push and pop, and applications like expression evaluation. It discusses the different Polish notations (prefix, postfix, infix) and rules for expression conversion, including precedence and associativity of operators. The goal is to explain how to use a stack to convert an infix expression to postfix notation through an algorithm.

Uploaded by

Priti Lokhande
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views12 pages

Dsu Presentation

The document describes infix to postfix conversion using a stack. It defines what a stack is, its operations like push and pop, and applications like expression evaluation. It discusses the different Polish notations (prefix, postfix, infix) and rules for expression conversion, including precedence and associativity of operators. The goal is to explain how to use a stack to convert an infix expression to postfix notation through an algorithm.

Uploaded by

Priti Lokhande
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

PROJECT NAME

INFIX TO POSTFIX CONVERSION USING


STACK

GROUP MEMBER:
PRIYA LOKHANDE
SNEHA JOGDAND
CONTENT

• Introduction
• What is stack
• Applications of stack
• Polish notations
• Rules for conversion
• Infix to postfix conversion using stack
• Algorithm for infix to postfix conversion
WHAT IS STACK ?

• Stack is a linear data structure.


• Stack consists a list of elements in which each element can be
inserted or deleted at one end is called as ‘Top of stack’.
• A stack is implemented using an array would starts from 0.
• Stack is based principle of LIFO . That stands for 'last in first
out’. or first in last out..
OPERATIONS PERFORM ON STACK

• Push operation
using push operation we can insert element into stack.
• Pop operation
using pop operation we can delete the elements from stack
• Stack full
stack is full when value of top is equal to equal to max -1
(Top == MAX – 1)
• Stack is empty When value of top is equal to equal to -1
(Top == -1)
APPLICATIONS OF STACK

• Stack is used to reverse a string


• Recursion
• Memory management
• Expression evaluation
• Expression conversion
1. Infix to prifix
2. Infix to postfix
3. Postfix to infix
POLISH NOTATION

• There are three types of polish notation are Exist in data structure
• Prefix polish notation.
When the operator is present before the operand is called as infix notation
for ex., +XY
• Postfix polish notation
when the operator is present in after the operand is called as postfix notation
for ex., XY+
POLISH NOTATION
• Infix polish notation
when the operator is present in between the operands. Then it is called as
infix polish notation
. For ex .,. X+Y
RULES FOR EXPRESSION CONVERSION
• Precedence of operator
when expression with only one operation is given then it is easy to answer it.
. For ex.,. (10+5) = 15
But many times operator have perform more than one operatoin , So there
are quite chances to get incorrect the answer .
for ex .,. 4+2*6. 4+2*6
=6*6. =12+4
=12. =16
• To solve this problem We uses the precedence rule
• The order of precedence rule is shown in given table
ASSOCIAVITY OF OPERATION

• Something operator having the same precedence

comes respectively of each other , then which


operations should be perform first It says by Associavity rule
For ex.,. (10*2÷3+2-1)
Using Associavity rule above expression can be solved:
10*3÷3+2-1
. =30÷3+2-1

. =10+2-1
. =12-1
. =11
EXAMPLE

You might also like