Implement queue using stack | GeeksforGeeks

preview_player
Показать описание

This video is contributed by Parul Shandilya.

Please Like, Comment and Share the Video among your friends.

Install our Android App:

If you wish, translate into local language and help us reach millions of other geeks:

Follow us on Facebook:

And Twitter:

Also, Subscribe if you haven't already! :)
Рекомендации по теме
Комментарии
Автор

I want more questions about qeue and stack please🌸

raneenothman
Автор

I'm so used to listening to male lecturers on fast forward. Thank you Parul

JohlBrown
Автор

In the second method, we push the new element on top of stack for implementing Enqueue() operation.For representing a queue, doesn't the element should have been added as last element of stack ?

amanpandya
Автор

Great video! Please correct me if I'm wrong here.

In the video he says 2nd method is better than the first one but I don't understand why. I think both methods are same because, in the method 2 dequeue operation, we put all the elements in to another stack and then pop the top one which is good. But the video doesn't explain the continuation of it.

After we move everything into stack 2 and pop the first element, we obviously need to move back all the elements from stack 2 to stack 1 right? Otherwise, the next enqueue operation is not possible.

sandeepa
Автор

also make video on implement stack using queue

usama
Автор

Beware !
At 3:40 she removed the items from stack 1 too, which is stupidity, she should just copy them to stack 2.
Then only method 2 is better (since deque will be theta(1) when stack to has elements (not empty), otherwise when empty, we'll need to push all the elements to stack 2, and then pop them which is theta(n)

Hope it clears the reader's doubt✌


P.S - I am a class 12th student

androidking
Автор

speak louder gal
what's the point if u r not audible without earphones

ashitranjan
Автор

U r just reading the content and plz improve the slang

amruthachitluri
welcome to shbcf.ru