‹ Back to the paper
Convert the following infix notation to prefix notation.
Convert the following infix notation to prefix notation.
$(A - B) / C * (D + E)$
Answer
Answer
AI$(A - B) / C * (D + E)$; / and * have equal priority and are evaluated left to right, so it is $((A - B) / C) * (D + E)$.
Step 1: $(A - B) \to -AB$ and $(D + E) \to +DE$
Step 2: $(-AB) / C \to /-ABC$
Step 3: $(/-ABC) * (+DE) \to */-ABC+DE$
Prefix: $* \, / \, - \, A \, B \, C \, + \, D \, E$
From ISC 2023 Computer Science Paper 1, question 2(i).