‹ Back to the paper
Question 2(i)
2 marks
Computer ScienceISC 2024 Computer Science Paper 1ConversionData structures
Answer the following.
Convert the following infix notation to postfix form. (P + Q * R - S) / T * U
Convert the following infix notation to postfix form.
$(P + Q * R - S) / T * U$
Answer
Answer
$(P + Q * R - S) / T * U$
Using operator precedence ($*,/$ before $+,-$, left to right) and converting inside-out:
Inner $(P + Q*R - S) \to P\ Q\ R\ *\ +\ S\ -$
Divide by T: $P\ Q\ R\ *\ +\ S\ -\ T\ /$
Multiply by U:
Postfix: $P\ Q\ R\ *\ +\ S\ -\ T\ /\ U\ *$