Page 505 - Computer science 868 Class 12
P. 505
Operator + is +
pushed to stack ( A B + C D
*
(
/
Operand E +
appended with ( A B + C D E
postfix *
expression (
/
Right ) Closing bracket encountered. All the operators A B + C D E +
parenthesis ) + till opening parenthesis popped and appended
pushed to stack ( to the postfix expression
*
(
/
Right ) Closing bracket encountered. All the operators A B + C D E + *
parenthesis ) * till opening parenthesis popped and appended
pushed to stack ( to the postfix expression
/
End of scanning / A B + C D E + * /
b. Bracket method
Ans. i. Enclose the parts of the expression between left and right parenthesis according to the precedence of
operators.
ii. Express the elements within the brackets in postfix notation.
(A + B) / (C * (D + E))
= (AB +) / (C * (D E +))
= (A B +) / (C D E + *)
= A B + C D E + * /
2. Convert the following Infix expression to its postfix form. [ISC 2011]
(A + B * C - D / E)
a. Stack Method
Ans. Scanned symbol Stack Postfix expression
Left parenthesis (
pushed to stack (
503
Data Structures 503

