Q49
MCQ2 marks, −0.5An implementation of a queue , using two stacks and , is given below: void insert (Q, x) { push (S1, x); } void delete (Q) { if (stack-empty(S2)) then if (stack-empty(S1)) then { print(“Q is empty”); return; } else while (!(stack-empty(S1))){ x=pop(S1); push(S2,x); } x=pop(S2); } Let insert and delete operations be performed in an arbitrary order on an empty queue . Let and be the number of push and pop operations performed respectively in the process. Which one of the following is true for all and ?
Sign in to save attempts.
Loading…