9 votes 9 votes The queue data structure is to be realized by using stack. The number of stacks needed would be It cannot be implemented 2 stacks 4 stacks 1 stack DS isro2015 data-structures stack + – go_editor asked Jun 17, 2016 go_editor 4.4k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 9 votes 9 votes The correct option is B. Pankaj kumar answered Jul 13, 2016 selected Jun 28, 2017 by Kapil Pankaj kumar comment Share Follow See all 4 Comments See all 4 4 Comments reply shekhar chauhan commented Jul 13, 2016 reply Follow Share @pankaj kumaras you have written if we want to perform queue operation then we need to pop ...but actually for queuing you don't need to pop you just need to push the elements in stack A like push a then push b push c this is for queuing but for dequeuing you must pop them from stack A and push them into B now for dequeuing pop then one by one to maintain the queue order. 1 votes 1 votes Pankaj kumar commented Jul 13, 2016 reply Follow Share you are right but the case is after insertion some element we want to remove an element from the queue and then again we want insertion that's why i did this. 0 votes 0 votes Pankaj kumar commented Jul 13, 2016 reply Follow Share it will work for all the cases. 0 votes 0 votes viral8702 commented Jun 24, 2023 reply Follow Share Here if asked that for enqueue purpose how many stacks will be required? Then answer will be 1 right? 0 votes 0 votes Please log in or register to add a comment.
6 votes 6 votes Answer is b) 2 stacks http://www.geeksforgeeks.org/implement-stack-using-queue/ Kapil answered Jun 17, 2016 Kapil comment Share Follow See all 0 reply Please log in or register to add a comment.