Let Q be a queue and S be a stack. Assume that Q and S are initially empty.…
Let Q be a queue and S be a stack. Assume that Q and S are initially empty.
Enqueue (Q, 7);
Enqueue (Q, 4);
Push(S,7);
Push(S,9);
for(i=0;i< n;i++)
{
printf(“%d”,Pop(S));
printf(“%d”,Dequeue(Q));
Enqueue (Q,i);
Push(S, i+5);
}
If we get last printed value 3 as output after executing the above program then what is the suitable value of n which used in for loop? __________
Attempted by 117 students.
Sign up free to check your answer
Sign up freeLoading lesson…