The reverse Polish notation of the following infix expression [A*{B+C*(D+E)}]…
2021
The reverse Polish notation of the following infix expression [A*{B+C*(D+E)}] / {F*(G+H)} is__________.
- A.
ABCDE+*+*FGH+*/
- B.
ABCDE*++*FGH+*/
- C.
ABCDE+*+*FGH*+/
- D.
ABCDE+**+FGH+*/
Attempted by 455 students.
Show answer & explanation
Correct answer: A
Method:
Evaluate the innermost parentheses first: D+E becomes DE+.
Multiply C by the result: C*(D+E) becomes CDE+*.
Add B to that result: B + (C*(D+E)) becomes BCDE+*+.
Multiply A by that sum: A * (B + C*(D+E)) becomes ABCDE+*+*.
For the denominator, add G and H: G+H becomes GH+.
Multiply F by that sum: F*(G+H) becomes FGH+*.
Finally, divide the numerator postfix by the denominator postfix by concatenation with the division operator:
Numerator: ABCDE+*+*
Denominator: FGH+*
Postfix (reverse Polish notation): ABCDE+*+*FGH+*/
A video solution is available for this question — log in and enroll to watch it.