GATEverse Practice, past papers & mock tests
GATE 2016 · CS1 - Forenoon
AlgorithmsAlgorithm Analysis and Asymptotic NotationshardNAT2 marks
Queue Q contains 16 numbers and S is an empty stack. Algorithm: 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 is _______
Save your progress

Related Algorithms PYQs