Let Q be a queue and S be a stack. Assume that Q and S are initially empty. What is the last integer value printed by the following code?
Enqueue(Q,8);
Enqueue(Q,3);
Push(S,7);
Push(S,9);
For(i=0;i<5;i++)
{
Printf(ā%dā,Dequeue(Q));
Printf(ā%dā,Pop(S));
Enqueue(Q,i);
Push(S, i+5);
}
1
2
2
8
3
3
4
9