• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
July 08, 2022 |5.3K Views

Sorting a queue without extra space

  Share   Like
Description
Discussion

Given a queue with random elements, we need to sort it. We are not allowed to use extra space. The operations allowed on queue are : 
 

enqueue() : Adds an item to rear of queue. In C++ STL queue, this function is called push().
dequeue() : Removes an item from front of queue. In C++ STL queue, this function is called pop().
isEmpty() : Checks if a queue is empty. In C++ STL queue, this function is called empty().


Sorting a queue without extra space  : https://www.geeksforgeeks.org/sorting-queue-without-extra-space/