What is the Polish notation (Prefix form) of the given infix expression?…
2021
What is the Polish notation (Prefix form) of the given infix expression?
(A∗B+C)/(E−F∗G)
Answer: B. /+*ABC–E*FG — ConceptIn prefix notation, each binary operator is written before its two operand subexpressions. The root operator comes from the outermost operation, while…
- A.
+*/ABCE*FG
- B.
/+*ABC–E*FG
- C.
/ABC+*–E*FG
- D.
+/ABC*–E*FG
Attempted by 832 students.
Show answer & explanation
Correct answer: B
Concept
In prefix notation, each binary operator is written before its two operand subexpressions. The root operator comes from the outermost operation, while precedence and parentheses determine the left and right subtrees.
Application
Rewrite the grouping explicitly as ((A*B)+C)/(E−(F*G)). The outermost operation is division, so / is the root operator.
In the numerator, A*B becomes * A B. Adding C gives + * A B C.
In the denominator, F*G becomes * F G. Subtracting this product from E gives − E * F G.
Place the numerator and denominator prefix strings after the root operator: / + * A B C − E * F G.
Cross-check
Parsing / + * A B C − E * F G recreates a division whose numerator is (A*B)+C and whose denominator is E−(F*G). Therefore the prefix form is /+*ABC−E*FG.