1.7k views

Convert the following infix expression into its equivalent post fix expression (A + B^ D) / (E – F) + G

1. ABD^ + EF – / G+
2. ABD + ^EF – / G+
3. ABD + ^EF / – G+
4. ABD^ + EF / – G+
in DS
recategorized | 1.7k views

Given Expression is (A + B^D ) / (E - F) + G

first we look at precedence and associativity and a/c to that "()" has higher precedence among all operators so we are going to evaluate them first .Lets take this first  (A + B^D )

inside this again we have 2 operators one is "+" and other is "^" in which Exponentiation operator has higher precedence .so

it will evaluate it like this

A+ BD^  then  ABD^+ now let move to the second one which is (E - F)  it will be EF- till now we have

ABD^+  / EF- + G

Now among both operators which has to be evaluated  "/" has higher precedence so we'll evaluate it first

ABD^+EF- /+ G

now finally we are going to evaluate "+"

Final Postfix expression will be ABD^+EF-/G+

by Boss (45.4k points)
selected
0
here \ will come after - please correct it.
0
0

now,it is correct. For the given expression , postfix notation is

ABD^+EF-/G+

I assume ^+ is merged to ^  in option A.

by Boss (33k points)