Log In
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

2 Answers

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
here \ will come after - please correct it.
@leen please check once.

 shekhar chauhan now,it is correct.yes

0 votes

Answer A

For the given expression , postfix notation is


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

Hence A is the answer


Related questions

3 votes
4 answers
How many PUSH and POP operations will be needed to evaluate the following expression by reverse polish notation in a stack machine $(A ∗ B) + (C ∗ D/E)$? $4$ PUSH and $3$ POP instructions $5$ PUSH and $4$ POP instructions $6$ PUSH and $2$ POP instructions $5$ PUSH and $3$ POP instructions
asked Jul 18, 2016 in DS makhdoom ghaya 3.5k views
3 votes
3 answers
A certain tree has two vertices of degree $4$, one vertex of degree $3$ and one vertex of degree $2$. If the other vertices have degree $1$, how many vertices are there in the graph ? $5$ $n – 3$ $20$ $11$
asked Jul 15, 2016 in DS makhdoom ghaya 5.7k views
3 votes
3 answers
You have to sort a list $L$, consisting of a sorted list followed by a few ‘random’ elements. Which of the following sorting method would be most suitable for such a task ? Bubble sort Selection sort Quick sort Insertion sort
asked Jul 21, 2016 in Algorithms makhdoom ghaya 3.1k views
1 vote
2 answers
If we have six stack operationspushing and popping each of $A, B$ and $C$-such that push $(A)$ must occur before push $(B)$ which must occur before push $(C)$, then $A, C, B$ is a possible order for the pop operations, since this could be our sequence ... orders could not be the order the pop operations are run, if we are to satisfy the requirements described above? $ABC$ $CBA$ $BAC$ $CAB$
asked Sep 16, 2016 in DS makhdoom ghaya 1.4k views