Convert the following infix expression to its equivalent postfix expression, showing the stack contents for each step of conversion.
X / Y + U* (VW)
X / Y + U* (VW)=((X / Y)+(U*(VW)))
Element | Stack | Postfix |
X | X | |
/ | / | X |
Y | / | XY |
+ | + | XY/ |
U | + | XY/U |
* | +* | XY/U |
( | +*( | XY/U |
V | +*( | XY/UV |
- | +*(- | XY/UV |
W | +*(- | XY/UVW |
) | +* | XY/UVW- |
+* | XY/UVW-* | |
XY/UVW-*+ |