Convert the following infix expression into its equivalent post fix expression…

2014

Convert the following infix expression into its equivalent post fix expression

(A + B^ D) / (E – F) + G

  1. A.

    ABD^ + EF – / G+

  2. B.

    ABD + ^EF – / G+

  3. C.

    ABD + ^EF / – G+

  4. D.

    ABD^ + EF / – G+

Attempted by 736 students.

Show answer & explanation

Correct answer: A

Final postfix expression: A B D ^ + E F - / G +

  1. Handle the exponent first: B^D becomes B D ^ because exponentiation has highest precedence and appears immediately after its operands in postfix.

  2. Form the numerator A + (B^D): this becomes A B D ^ +.

  3. Form the denominator E - F: this becomes E F -.

  4. Apply the division to the two results: A B D ^ + E F - /.

  5. Finally add G to the result: A B D ^ + E F - / G + which is the final postfix expression.

Note: Operator precedence and associativity determine this order: exponentiation has highest precedence and is right-associative, while multiplication/division come next and addition/subtraction last. In postfix, each operator appears after its operands.

Explore the full course: Coding For Placement