plasticfood 0 Junior Poster in Training

this assignment has stomped me. i thought it about long and hard and can't imagine how would i edit the quicksort to sort an array-based queue object.

i'm required to use an array-based queue class which has only 3 methods: enqueue(), dequeue(), and peek(). they're pretty self explanatory. i cannot modify it to access the array's subscript obviously. then i have to modify a quicksort method so that it'll sort the queue. and no, i can't import the values of the queue to an array and sort it from there.

for example in the main class:
queue q = new queue(5); //the array has a size of 5
q.enqueue("names"); //add more names to the internal array
...
quicksort(q);

------------------------------------------------

the question is how would i do it? i can select a value to be the pivot, and put it into a temp queue, but then what?? how would i do this without destroying the purpose of a quicksort? someone please give me a hint.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.