Professional Documents
Culture Documents
Data Stavchyae: F o Ype
Data Stavchyae: F o Ype
DELTA PO No
Data Stavchyae
1)Deline data shuctuae In houo many toay8 can yev
Categox2e data &tau ctuaCA Cnd Explain eauh e them
nend
uUR Queue a a linea s t f dota LLmA
tcohichPnsenhon take place called 2en d
Qlatien takes plae ot anolhe_ end Called fsont
Tel
Thig h u t - e Pa nesthy USed tD Cpesert
data celaining a hienanchical azelaienhip
betuoeen elmrts e.9aeco&C relcctiem3 ae
and fohle e Lemknh.
1 (11)0-2--2
20 23
(23)
Tem-5 THem- 3
20 (20)3-1=2
23 23
3
Hem-
(20
(23)
(23
Tem-9 THem 6
20
( ()
S 4 De-
Date
DELTA Pg No
Posth xp>e8iom
3à01o,* 10, 60 10
SyMBOL STA CR
2-0 3-0
LO,320
3200
18 5
18.9
Alqorithm for evaluation of Postfix Expression
at the end of postfix expression
Step 1: Add a right parenthesis the step 3 and
expression from left to right and repeat
Step2: Scan each operator of postfix is encountered.
step 4 until the right parenthesis
encountered then add it into
the stack.
Step 3: If an operand is 2 elements from the
stack and assign with
encountered removetopthe
Step 4: If operator is
stack.
will be in the Top of the
Y operator X. Result
X and Y. After that perform
Step 5: Set value =
Top of the stack.
Step 6: Exit
Stacks
45
Algorithm to Convert Infix to Postfix
Expression
Step 1: Add left parenthesis into the stack and add right parenthesis at the end of infix
expression.
Step 2: Scan the infix expression from left to right and repeat step-3 to step-6 until the stack
is empty.
Step 3: If an operand
is encountered add it to the
postfix expression.
Step 4: If a left parenthesis is encountered then add it into the stack.
Step 5:
If an operator is encountered then
repeatedly delete all the operator from the stack
which has the higher precedence than the incoming operator.
same or
Add all deleted operator into the postfix expression and add the incoming
into the stack. operator
Step 6: If a right parenthesis is encountered remove all the
operator from the stack up to
the left parenthesis and add these deleted into the postfix expression and
operators
remove the left parenthesis from the stack.
Step 7: Exit
Example 1
Convert Infix expression in to the Postfix expression:
5°(6+2)-12/4
Add right parenthesis in the last of Infix expression
5°(6+2)-12/4)
(
6 ( 5,6
((+ 5,6
((+ 5,6,2
5,6,2,+
5,6,2,+,
12
5,6,2,+,',12
(-/ 5,6,2,+,,12
(-/ 5,6,2,12,4
5,6,2,+'12,4,/
2,3,+,4,2,*
Example4
Convert Infix expression in to the Postfix expression:
A-C+D/BA
Addright parenthesis in the last of Infix expression
A-C+D/BA)
Symbol Stack Postfix
A A
A
C ( A,C
(+ A,C,
D + A,C,,D
(+/ A,C,-,D
B (+/ A,C,,D,B
(+* A,C,,D,B,/
A (+* A,C, ,D,B, /,A
A,C,-,D,B,/,A,',+
Algorithrm for evaluation of Postfix Expression