GATE | GATE-CS-2006 | Question 49
An implementation of a queue Q, using two stacks S1 and S2, is given below:
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.
Let n insert and m (<=n) delete operations be performed in an arbitrary order on an empty queue Q. Let x and y be the number of push and pop operations performed respectively in the process. Which one of the following is true for all m and n?
(A) n+m <= x < 2n and 2m <= y <= n+m
(B) n+m <= x < 2n and 2m<= y <= 2n
(C) 2m <= x < 2n and 2m <= y <= n+m
(D) 2m <= x <2n and 2m <= y <= 2n
Explanation: Same as https://www.geeksforgeeks.org/data-structures-queue-question-10/
Quiz of this Question