‹ Back to the paper
Question 2(c)
2 marks
Computer ScienceISC 2019 Computer Science Paper 1Short answerData structures
Answer the following in short.
Convert the following infix notation to postfix form: ( A + B * C ) - ( E * F / H ) + J
Convert the following infix notation to postfix form:
$( A + B * C ) - ( E * F / H ) + J$
Answer
Answer
$(A+B*C) - (E*F/H) + J$
Using operator precedence ($*$, $/$ before $+$, $-$) and left-to-right evaluation, and converting bracket by bracket:
$(A+B*C) \to A\ B\ C\ *\ +$
$(E*F/H) \to E\ F\ *\ H\ /$
Combining with $-$ and then $+J$:
Postfix: $A\ B\ C\ *\ +\ E\ F\ *\ H\ /\ -\ J\ +$