Dsu Presentation
Dsu Presentation
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 ?
• 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
• 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
. =10+2-1
. =12-1
. =11
EXAMPLE