in DS edited by
6,147 views
2 votes
2 votes

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 edited by
6.1k views

2 Answers

3 votes
3 votes
Best answer

Answer : A

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+

selected by

3 Comments

here \ will come after - please correct it.
0
0
@leen please check once.
0
0

 shekhar chauhan now,it is correct.yes

0
0
0 votes
0 votes

Answer A

For the given expression , postfix notation is

ABD^+EF-/G+

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

Hence A is the answer

by
Answer:

Related questions