edited by
1,018 views
3 votes
3 votes

There is given a infix expression:

                                                             ${\color{Red} {1}}$

$A+B\times C/\left ( \left ( D+E \right )+F\times G \right )$

While converting infix expression to postfix expression number of symbols in the stack at indicated ${\color{Red} {point-1}}$ infix expression (assume stack is initially empty) ______________


they told $5$, but is it correct? Can anyone give some explanation??

edited by

3 Answers

1 votes
1 votes
Yes it is 5
0 votes
0 votes

5 is right

0 votes
0 votes

Answer should be 6. The symbol ‘(‘ can never be popped from the stack whatever may be the precedence level of scanned character. If the character is closing round bracket ( ')' ), pop out operators from operator's stack until we find an opening bracket ('(' ) .

Due to this reason, the operator stack will contain +/((+*.

If you count this, these operators total to 6 & hence the answer.

Related questions

9 votes
9 votes
5 answers
1
target2017 asked Jan 7, 2017
2,968 views
How it is 24? I'm not getting it.
2 votes
2 votes
2 answers
4
jatin khachane 1 asked Dec 1, 2018
1,227 views
My doubt : What should we consider ^ operator as Bitwise XOR ? or Exponentiation