hi my name is qurat .. i have a small problem :rolleyes: i dunno how to do this program .. i have tried it several timez but it is giving some or the other error
here it is:

Implement a Queue using two Stacks (implement Stack using link list).
plz if any body can help me out in this question i wud b xtremely grateful
thx
qUrAt;)

Recommended Answers

All 4 Replies

Please post the code you wrote -- I left my crystal ball at home this morning. And please read the links in my signature.

Hi...Its Virtual University assignment...

can any onr tell me to implement queue using stacks

Preety simple.
Enqueue:
Get a data & then push it on to stack 1. squeeze stack1 like a lemon till it dries & collect them in stack 2.
Dequeue:
Squeeze stack2 this time & collect in stack1
pop the data from stack1.
I leave one more important point for you to figure out.

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.