Q41
NAT2 marksLet denote a queue containing sixteen numbers and be an empty stack. returns the element at the head of the queue without removing it from . Similarly returns the element at the top of without removing it from . Consider the algorithm given below. while Q is not Empty do if S is Empty OR Top(S) ≤ Head (Q) then x:= Dequeue (Q); Push (S, x); else x:= Pop(S); Enqueue (Q, x); end end The maximum possible number of iterations of the while loop in the algorithm is _______.
Sign in to save attempts.
Loading…