The Gateway to Computer Science Excellence
+2 votes
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 by Boss (30.8k points)
recategorized | 1.7k views

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+

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

 shekhar chauhan now,it is correct.yes

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 Boss (33k points)
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,309 answers
198,331 comments
105,021 users