Q. Convert the following infix expression to its equivalent postfix expression showing stack contents for the conversion: X - Y / (Z + U) * V
Answer :-
ELEMENT | STACK | POSTFIX |
---|---|---|
X | X | |
- | - | X |
( | -( | X |
Y | -( | XY |
+ | - ( + | XY |
Z | - ( + | XYZ |
) | - | XYZ+ |
/ | -/ | XYZ+ |
U | -/ | XYZ + U |
* | -* | XYZ + U/ |
V | -* | XYZ +U/V |
XYZ+U/V*- |
Final Answer :- XYZ+U/V*-
Answer is: XYZU+/-V*
ReplyDeletexy-zu+/*
ReplyDeleteYes harry is right u have missed division sign....
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )