Choosing a pivot and recursively applying the QuickSort procedure on left and right arrays is kind of how all QuickSort implementations work. I think the problem here is that you need to be more precise about some things that could vary across implementations. For example
1) How do you choose the pivot? Some ideas of how the pivot could be chosen are:
a) Pick the first element always
b) Randomly select an element from the array
c) Get the median and pick that as pivot
The choice determines the order of growth, the constants, and of course it determines how the array will be subdivided.
2) Once you have a pivot, how do you then move all the elements smaller than the pivot to the left of the pivot, and the largers to the right? This can also vary according to the implementation, even if any good one will be
O(n).
I think the best idea for the sake of clarity would be to just disclose the full pseudocode so that you can be guided step by step.
[ April 07, 2008: Message edited by: Alberto Caraz ]