How many PUSH and POP operations will be needed to evaluate the following expression by reverse polish notation in a stack machine $(A ∗ B) + (C ∗ D/E)$?
@sanjay they have asked operation not operand, in postfix evaluation algo we generally push operand onto the stack I have considered then operation thats why 6 push . if i would have considered them seperate and as a operand then push of operand onto the stack would be even more.
two push operands in single operation is not possible . doesn't matter whether push operation increases or not we can not leave basic thing behind .something else in missing in the question
I thing you have written wrong postfix expression it should be AB*CD*E/+ not AB* CDE /* +
Though your procedure is right
The algorithm for evaluating any postfix expression is fairly straightforward:
5 push and 4 pop (B)