Dark Mode

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

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.