Implementing Queue Using Stack:

Thursday, September 13, 2012
Goforexam.in | Guide for Placements, Aptitude, Interviews, Projects.....: Implementing Queue Using Stack:
Question: How would you use stacks to implement a queue? Answer: So how could we go about doing this? What if we used two stacks and used one as the incoming stack and the other as the outgoing stack? A queue is a FIFO structure, so when we enqueue something, we need to make sure that it does not get popped off before something that was already there. Similarly, when we dequeue something, we have to make sure that elements...
Read more ...

0 Comments:

Post a Comment

comment

 
 
 

Recent Posts

New User Register Here

 
Copyright © 2010-2011 Find Out What You Want
Bloggerized by Mangesh Shinde