Postfix to infix operations is performed on the following express

Postfix to infix operations is performed on the following express
|

Postfix to infix operations is performed on the following expression. Using stack we need to perform the set of PUSH and POP operations depending upon the operator or operand in the expression. At a certain point, the top of the stack is “s -t”.

How many push and pop operations are performed till that moment.

\(pqr + - \;st - uv - w + *\)

A. 6,8

B. 8,6

C. 6,6

D. 8,8

Please scroll down to see the correct answer and solution guide.

Right Answer is: B

SOLUTION

When there is an operand PUSH it on the stack, when there is an operator, POP top two operands from the stack and perform the operation and push the result back.

Here are the steps followed:

Total push operations = 8

Total Pop operations = 6