Open In App

Data Structures | Queue | Question 3

Like Article
Like
Save
Share
Report

How many stacks are needed to implement a queue. Consider the situation where no other data structure like arrays, linked list is available to you.

(A)

1

(B)

2

(C)

3

(D)

4



Answer: (B)

Explanation:

A queue can be implemented using two stacks.

Refer this for more reference:
https://www.geeksforgeeks.org/queue-using-stacks/

Hence Option(B) is the correct answer.


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 01 Feb, 2013
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads