• edited by
1,997 views
3 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??

3 Answers

1 1 vote
Yes it is 5
0 0 votes

5 is right

0 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.

Position:
Show:

Related questions

9 9 votes
5 5 answers
5.7k
5.7k views
target2017 asked Jan 7, 2017
5,654 views
How it is 24? I'm not getting it.
1 1 vote
1 1 answer
1.4k
1.4k views
srestha asked May 22, 2019
1,422 views
A stack based CPU executes the instruction. Memory location $500$ contain $0X 88$ and memory location $700$ contain $0X37$. The stack pointer is at $0X003F$The instructio...
10 10 votes
2 2 answers
481
481 views
GO Classes asked Jul 27
481 views
Given a stack $S$ with $5$ elements from top to bottom as:$2, 4, 6, 8, 10$and an empty queue $Q$.First, remove the elements one by one from $S$ and insert them into $Q$.T...
8 8 votes
2 2 answers
594
594 views
GO Classes asked Jul 27
594 views
Which of the following statements are true?$\text{S1.}$ Stack operations $\texttt{push}$, $\texttt{pop}$, and $\texttt{isEmpty}$ can be worst-case $O(1)$ for a linked-lis...