The queue data structure is to be realized by using stack. The number of stacks needed would be
(A) It cannot be implemented
(B) 2 stacks
(C) 4 stacks
(D) 1 stack
Explanation: A queue can be implemented using 2 stacks. Refer: Implement Queue using Stacks
Option (B) is correct.
Quiz of this Question
Please comment below if you find anything wrong in the above post
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.