In Reverse Polish notation, expression A*B+C*D is written as
- (A)
AB*CD*+
- (B)
A*BCD*+
- (C)
AB*CD+*
- (D)
A*B*CD+
In Reverse Polish notation, expression A*B+C*D is written as
AB*CD*+
A*BCD*+
AB*CD+*
A*B*CD+
ANSWER
The postfix form is , option (a).
Official answer: ASource: ISRO's revised and final answer key of 16 February 2024
Reverse Polish (postfix) notation writes each operator after its two operands, so no brackets are needed.
Precedence: * binds tighter than +, so the expression is .
Convert the left product: .
Convert the right product: .
The + joins the two results, so it goes after both: , which is .
Check by evaluating the string with a stack: push A, push B, * gives ; push C, push D, * gives ; + adds the two results. This is the original expression.
Option (b) A*BCD*+ and option (d) A*B*CD+ are not valid postfix: each has a * right after the single operand A, with no second operand before it. Option (c) AB*CD+* evaluates to , a different expression.
KEY IDEA
Apply precedence first, then place every operator after its two operands: the two products are converted separately and the + goes last.
WATCH OUT FOR
Leaving an operator between operands, as in infix, or placing + before the second product so that it ends up applied to the wrong operands, as in .
From the ISRO CS 2023 paper. Every question of this paper · The full paper (PDF, ISRO) · All 1 ISRO Linear structures question, with notes