761 views

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??

Yes it is 5
by

how??
Can you give the explanation please.

I got  ABC*DE+FG*+/+ as postfix expression with stack size 6, please verify it.

i got 5

5 is right

I think it will be ABCxDE+FGx+/+

Please read the question. It clearly says that we have to do pop and push operation in operator stack till "Point 1" only. It means for last operator ")" we don't have to do the operation.

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.

by