Exam-style question
Try this first
Convert the infix expression (A + B) * (C - D) into RPN. Explain how the order of the RPN expression represents the brackets.
Answer and explanation
Concise answer
AB+CD-*
Why this is correct
The first bracketed sub-expression, A + B, becomes AB+. The second bracketed sub-expression, C - D, becomes CD-. The multiplication operator is placed after both completed sub-expressions, producing AB+CD-*. The position of the operators preserves the order imposed by the brackets, so additional brackets are not required in the RPN form.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
