Page 504 - Computer science 868 Class 12
P. 504
Let us evaluate the same with the following examples.
1. Convert the following Infix expression to its postfix form. [ISC 2010]
(A + B) / (C * (D + E))
a. Stack method
Ans. Scanned symbol Stack Postfix expression
Left parenthesis ( (
pushed to stack
A operand sent ( A
to output
+ operator + A
pushed to stack (
B operand sent + A B
to output (
Right ) Closing bracket encountered. All the operators till
parenthesis ) + opening parenthesis popped and appended to the A B +
pushed to stack ( postfix expression. Stack empty . Brackets discarded
/ operator / A B +
pushed to stack
Left parenthesis ( ( A B +
(pushed to stack /
Operand C ( A B + C
appended with /
postfix
expression
Operator * is * A B + C
pushed to stack (
/
Left parenthesis ( ( A B + C
pushed to *
stack (
/
Operand D ( A B + C D
appended with *
postfix (
expression /
502502 Touchpad Computer Science-XII

