By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,630 Members | 1,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,630 IT Pros & Developers. It's quick & easy.

implementation of stack using queuqe

P: 1
How to implement a stack using queuqe
Mar 19 '10 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 2,057
In general, it's a pretty bad idea.
There's a couple avenues you could take. Did you want to use a double queue option to implement the stack?

Or are you talking Singly Linked List? That would make a lot more sense.
Mar 19 '10 #2

Expert 100+
P: 2,400
What do you mean by queue?

As abstract software engineering terms, a stack is a last-in-first-out (LIFO) structure, while a queue is a first-in-first-out (FIFO) structure. These are fundamentally incompatible. However, actual implementations of stacks and/or queues sometimes sacrifice conceptual purity for flexibility that might be used to breach the incompatibility.
Mar 19 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.