recategorized by
481 views
1 votes
1 votes
Five items $\text{A, B, C, D, E}$ are pushed onto a stack, one after other starting from item $\mathrm{A}$. The stack is then popped by three items, and each item is inserted into a queue. Next, two items are deleted from the queue, and the deleted items are pushed back onto the stack. Now, one item is popped from the stack. Which item is at the top of the stack.
recategorized by

1 Answer

0 votes
0 votes
After the five items are pushed onto the stack, the stack looks like this, with the top of the stack at the right:

A B C D E

After three items are popped from the stack and inserted into the queue, the queue looks like this, with the front of the queue at the left:

C D E

After two items are deleted from the queue and pushed back onto the stack, the stack looks like this:

E C

Finally, if one item is popped from the stack, the item at the top of the stack will be "C".

Related questions

1 votes
1 votes
1 answer
1
admin asked Dec 15, 2022
378 views
Find the number of binary tree(s) with $3$ nodes (i.e., $\text{A, B,}$ and $\text{C})$ which when traversed by pre-order gives the sequence $\textbf{C B A}$. You also nee...
1 votes
1 votes
0 answers
2
admin asked Dec 15, 2022
225 views
Calculate the eigenvalues of matrix $M, M^{-1}, M^{2}$ and $M+2 I$ where\[M=\left[\begin{array}{cc}4 & 5 \\2 & -5\end{array}\right].\]
1 votes
1 votes
1 answer
3
admin asked Dec 15, 2022
268 views
With no unique solution, solve for $n$ with the following system of equations$$\begin{array}{r}a+b+2 c=3 \\a+2 b+3 c=4 \\a+4 b+n c=6\end{array}$$
1 votes
1 votes
1 answer
4