Quicksort works fundamentally by recursively partitioning an unsorted set of elements until all
partitions contain a single element. In the implementation presented
here, * data* initially contains the unsorted
set of

`size`

`data`

`data`

As we have seen, an important part of quicksort is how we
partition the data. This task is performed in the function
*partition* (see Example
12.2) . This function partitions the elements between
positions * i* and

`k`

`data`

`i`

`k`

We begin by selecting a partition value using the
median-of-three method mentioned earlier. Once the partition value has
been selected, we move from * k* to the left
in

`data`

`i`

`i`

`k`

`i`

`k`

Start Free Trial

No credit card required