retagged by
5,361 views
0 votes
0 votes
The following post-fix expression with single digit operands is evaluated using stack,
                     $16\;2\;4\;\wedge \; / \;4\;3\;*\;+\;6\;2\;*\;-$

Note that $\wedge$ is the exponential operator. What is the maximum height of the stack and the final value of post-fix evaluation respectively are

a. $3,\;1$         b. $4,\;1$        c. $3,\;12$        d. $2,\;1$
retagged by

2 Answers

2 votes
2 votes
16 2 4 ^

16 16 /

1 4 3 *

1 12 +

13 6 2 *

13 12 -

1

So, Ans will be max height of stack 3

and final value 1
2 votes
2 votes

(P.S : Please bear with my poor handwriting :( )

Related questions

1 votes
1 votes
1 answer
1
0 votes
0 votes
1 answer
2
Ananya Jaiswal 1 asked Dec 12, 2017
2,565 views
Result for evaluating the following post fix105+606/*8-I'm confused whether it is correct postfix expression.
2 votes
2 votes
1 answer
4