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
Answer: B. 2 stacks
Explanation: A queue can be implemented using two stacks (s1 for enqueue, s2 for dequeue).