The reverse polish notation equivalent to the infix expression ((A + B) * C +…

2014

The reverse polish notation equivalent to the infix expression

((A + B) * C + D)/(E + F + G)

  1. A.

    A B + C * D + EF + G + /

  2. B.

    A B + C D * + E F + G + /

  3. C.

    A B + C * D + E F G + +/

  4. D.

    A B + C * D + E + F G + /

Attempted by 628 students.

Show answer & explanation

Correct answer: A

Final reverse polish notation: A B + C * D + E F + G + /

Conversion steps:

  1. Convert the numerator ((A + B) * C + D): compute A B + (for A + B), then multiply that result by C to get A B + C *, then add D to get A B + C * D +.

  2. Convert the denominator (E + F + G): using left-associative addition, write E F + G + (this is equivalent to E F G + + as well).

  3. Place the denominator after the numerator and apply the division operator: A B + C * D + E F + G + /.

Note: Ensure operators and operands are separated by spaces so each token is unambiguous.

Explore the full course: Coding For Placement