The Gateway to Computer Science Excellence
+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 by Boss (30.9k 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
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

by Boss (33k points)

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,394 answers
105,446 users