Data Structures and Algorithms - Stacks

13. In evaluating the arithmetic expression 2*3-(4+5), using stacks to evaluate its equivalent postfix form, which of the following stack configuration is not possible?

  • Option : D
  • Explanation : The postfix equivallent is 2 3 * 4 5 + -. For evaluating this using stack, starting from the left, we have to scan one by one, if it is an operand push. If it is an operator, pop it twice, apply the operator on the popped out entries and push the result onto the stack. If we follow this, we can find the configuration in option(d)is not possible
Cancel reply
Cancel reply