The following postfix expression with single digit operands is evaluated using a stack:
$$8 \ 2 \ 3 \ {}^\hat{} ∕ \ 2 \ 3 * + 5 \ 1 * -$$
Note that $^\hat{}$ is the exponentiation operator. The top two elements of the stack after the first $*$ is evaluated are
@Arjun sir , this question is still not corrected in go hardcopy 2020.
Hence, answer is A.
after 823 we've ^ in TOS , so we'll pop last two element & perform the operation that's fine.but my query is that why 2^3 not 3^2 & in case there is ' - ' in place of ' ^ ' then in which order it will be performed.
I mean sometimes for some operator order of the elelment will matter( e.g:' - ' & ' ^ ' as 3-2 or 2-3 and 2^3 or 3^2) Is there any general concept to remove this confusion???
@MRINMOY_HALDER......bottom of the element is 1st and top element 2nd......i.e 2-3=-1
better take any infix operation solve first then convert that postfix evaluate using postfix evaluation...you will get ans
So top two elements after 1st * is 6 , 1
The single important thing is, when you pop two elements, first one goes on right side.
64.3k questions
77.9k answers
244k comments
80.0k users