ISRO | ISRO CS 2017 | Question 53
The minimum number of stacks needed to implement a queue is
(A)
3
(B)
1
(C)
2
(D)
4
Answer: (C)
Explanation:
Two stacks S1 & S2 are required to implement a queue.
This method makes sure that newly entered element is always at the top of stack 1, so that DeQueue operation just pops from stack1. To put the element at top of stack1, stack2 is used.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Please Login to comment...