Reverse polish notation assignment answersstudent submitted image
Reverse Polish Notation Assignment Answers
Question:
Reverse Polish Notation Answer and Explanation
1. Read the postfix expression from left to right.
2. Use a stack to hold operators and operands.
1. Read U - Push `U` onto the stack.
2. Read V - Push `V` onto the stack.
7. Read `+` - Pop `Y` and `Z` from the stack, form the expression `(Y + Z)`, and push it back onto the stack.
8. Read `*` - Pop `(Y + Z)` and `X` from the stack, form the expression `X * (Y + Z)`, and push it back onto the stack.
`U + (V * (W + (X * (Y + Z))))`
### Expression b) XYZ+VW-*Z++
5. Read V - Push `V` onto the stack.
6. Read W - Push `W` onto the stack.
11. Read `+` - Pop `(Y + Z) * (V - W) + Z` and `X` from the stack, form the expression `X + ((Y + Z) * (V - W) + Z)`, and push it back onto the stack.
The infix notation for expression b) is: