Advertisements
Advertisements
Question
Convert the following Infix expression to its equivalent Postfix expression. showing the stack contents for each step of conversion
U * V + (W - Z)/X
Solution
Symbols | Stock | Expression |
U | U | |
* | * | U |
V | * | UV |
+ | + | UV* |
C | +( | UV* |
W | +C | UV*w |
- | +(- | UV*W |
Z | +(- | UV*WZ |
) | + | UV*WZ- |
/ | +/ | UV*WZ- |
X | +/ | UV*WZ-X |
UV*WZ-X/ | ||
UV*WZ-X/+ |
Postfix expression : UV*WZ–X/+
shaalaa.com
Is there an error in this question or solution?