How to sort a queue with a temporary queue?

175 Views Asked by At

I'm very amateur and bad with coding. there's a queue with elements and another empty queue. and these queues aren't arrays but generic with this empty queue you have to sort the original queue. The way: dequeue the q1head to other q2 ---> if q1 head < q2lastelement then enqueue q1head else enqueue q1head to q2. I understand how it goes but I can't code. could someone code this for me please, because this is a a homework for school. :)

0

There are 0 best solutions below