The following postfix expression with single-digit operands is evaluated using a stack:
The following postfix expression with single-digit operands is evaluated using a stack:
823^/23*+51*-
(Note that ^ is the exponentiation operator.) The top two elements of the stack after the first * is evaluated, are
Show answerHide answer
Correct answer: (A) 6, 1
Explanation
8 2 3 ^ gives 2³ = 8, then 8 / 8 = 1. Next 2 and 3 are pushed and * gives 6. The stack now holds 1, 6, so the top two elements are 6 and 1.