Suppose a stack implementation supports, in addition to PUSH and POP, an operation REVERSE, which reverses the order of the elements on the stack.
- To implement a queue using the above stack implementation, show how to implement ENQUEUE using a single operation and DEQUEUE using a sequence of $3$ operations.
- The following post fix expression, containing single digit operands and arithmetic operators $+$ and $*$, is evaluated using a stack.
$5 \ 2 * 3 \ 4 + 5 \ 2 * * +$
Show the contents of the stack
- After evaluating $5 \ 2 * 3 \ 4 +$
- After evaluating $5 \ 2 * 3 \ 4 + 5 \ 2$
- At the end of evaluation