how can I implement stack with one queue?
the queue only can enqueue and dequeue
sahar.97
0
Newbie Poster
Recommended Answers
Jump to PostWhat does your instructor and text book say? Aside from that, what language are you coding with? What have you done so far?
Jump to PostOkay?!? So what have you done so far? Have you made any methods like the push and pop methods?
Jump to PostOh wow, if you can't query the size of the queue that makes it harder.
Maybe you could keep your own counter of the number of elements in the queue?
Alternatively you could use the second approach (add new items at the front of the queue by adding it at …
All 10 Replies
Stuugie
50
Marketing Strategist
sahar.97
0
Newbie Poster
Stuugie
50
Marketing Strategist
sahar.97
0
Newbie Poster
Stuugie
50
Marketing Strategist
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
sahar.97
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
sahar.97
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.