Oct 17, 2015 at 1:53pm UTC
Please someone it's very urgent! Can you tell me how to reverse a queue? I mean I have two queues and I have to make a third one so that the first queue was there in the right and the second queue in a reversed order. I can't handle this,,,,
Thanks in advance
Oct 17, 2015 at 6:35pm UTC
are you using std::queue ? if so #include <algorithm> and use them
for instance begin() and end() are appropriate for that task.
Read more about it.
Oct 17, 2015 at 8:25pm UTC
actually I don't wanna use standard libraries, I'm a student and the whole work is done for learning. That's why I try to write everything by myself.
Oct 17, 2015 at 8:34pm UTC
The concept is FIFO (first in first out) think of an arrow in----->out
push_back()
pop_front()
or push and pop
the hint behind begin() and end() is two pointers(within an iterator) you will simply swap them
Oct 17, 2015 at 8:49pm UTC
thanks :) I have figured out another way too . It's by using recursion. And it works in a beautiful way I guess.