title: Can you reverse a queue by only reversing its head and tail pointers?
body: <p>While attempting to reverse a queue, I found a generally agreed upon way:</p>
  
  <p><em>You can dequeue through the queue, getting the dequeue value and pushing each one into a stack. Then you can go through that stack, popping each value and enqueueing it into the queue</em></p>
  
  <p>By agreed upon, I mean most of my Google searches on reversing a queue end up taking me to that solution. </p>
  
  <p>Even though that way is correct and relatively performant in linear time, I believe there's a better way that is simpler and more performant in constant time.</p>
  
  <p>Assuming that a queue is implemented using a doubly-linked list, can't you reverse it in O(1) time by just <em>reversing the head and tail pointers</em>?</p>