algorithm - A way to reverse queue using only two temporary queues and nothing more? -


There is only one way to not use two temporary queues (and any other variables, such as counter) in the queue ? Only standard queue operations are available: Enqueu (E), Decqu (), MPT ()?

The solution is welcome in any language or pseudocode.

You can:

  • Push all the elements of the original line on this stack.
  • Now populate each element from stacks and add it to the original line.

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -