edited by
6,304 views
6 6 votes

Convert the pre-fix expression to in-fix $- ^{\ast} +ABC^{\ast} – DE+FG$

  1. $(A-B)^{\ast}C+(D^{\ast}E)-(F+G)$
  2. $(A+B)^{\ast}C-(D-E)^{\ast}(F+G)$
  3. $(A+B-C)^{\ast}(D-E)^{\ast}(F+G)$
  4. $(A+B)^{\ast}C-(D^{\ast}E)-(F+G)$

5 Answers

6 6 votes
$\underline{\textbf{Answer:}\Rightarrow}\;\text{Option B}$

$\mathbf{((A+B)*C)-((D-E)*(F+G)))}$
edited by
1 1 vote

Infix should be: (((A+B)*C)-((D-E)*(F+G)))

I have tried it here: 

https://ide.geeksforgeeks.org/0C6l9aF7gd 

 

Code source: https://www.geeksforgeeks.org/prefix-infix-conversion/ 

edited by
1 1 vote
Just scan the operands from right to left and try to keep inside parantheses and update the parentheses as per requirement .

Step1 : (F+G)

Step2:(D-E) (F+G)

Step3:((D-E)*(F+G))

Step4:(skip C for now as we don't get any operator for the consecutive operands i.e. for BC)

Final Step:((A+B)*C)-((D-E)*(F+G))

Hence , Option B is correct.
Answer:
Position:
Show:

Related questions

4 4 votes
5 5 answers
8.3k
8.3k views
Satbir asked Jan 13, 2020
8,301 views
$G$ is an undirected graph with vertex set $\{v1, \ v2, \ v3, \ v4, \ v5, \ v6, \ v7\}$ and edge set $\{v1v2,\ v1v3,\ v1v4\ ,v2v4,\ v2v5,\ v3v4,\ v4v5,\ v4v6,\ v5v6,\ v6v...
11 11 votes
5 5 answers
6.7k
6.7k views
Satbir asked Jan 13, 2020
6,713 views
Of the following, which best approximates the ratio of the number of nonterminal nodes in the total number of nodes in a complete $K$-ary tree of depth $N$ ?$1/N$$N-1/N$$...
9 9 votes
4 4 answers
11.1k
11.1k views
Satbir asked Jan 13, 2020
11,060 views
The minimum height of an AVL tree with $n$ nodes is$\text{Ceil } (\log_2(n+1))$$1.44\ \log_2n$$\text{Floor } (\log_2(n+1))$$1.64\ \log_2n$
6 6 votes
4 4 answers
7.0k
7.0k views
Satbir asked Jan 13, 2020
7,041 views
A stack is implemented with an array of $’A[0...N-1]’$ and a variable ‘$pos$’. The push and pop operations are defined by the following code.push (x) A[pos] <- x pos <- p...