Efficient implementations of Quicksort are not a stable sort, meaning that the relative order of equal sort items is not preserved. develop by British computer scientist Tony Hoare in 1959 and published in 1961, it is still a normally used algorithm for sorting. Robert Sedgewick's Ph.D. thesis in 1975 is considered a milestone in the survey of Quicksort where he resolved many open problems associated to the analysis of various pivot choice schemes including Samplesort, adaptive partitioning by Van Emden as well as derivation of expected number of comparisons and swaps. Jon Bentley and Doug McIlroy integrated various improvements for purpose in programming library, including a technique to deal with equal components and a pivot scheme known as pseudomedian of nine, where a sample of nine components is divided into groups of three and then the median of the three medians from three groups is choose. In the Java core library mailing lists, he initiated a discussion claiming his new algorithm to be superior to the runtime library's sorting method, which was at that time based on the widely used and carefully tuned variant of classic Quicksort by Bentley and McIlroy.

Recursively use the above steps to the sub-array of components with smaller values and separately to the sub-array of components with greater values. The pivot choice and partitioning steps can be done in several different ways

```
//
// C++ implementation of quick sort
//
// The All ▲lgorithms Project
//
// https://allalgorithms.com/sorting
// https://github.com/allalgorithms/cpp
//
// Contributed by: Nikunj Taneja
// Github: @underscoreorcus
//
#include <iostream>
#include <vector>
void quick_sort(std::vector<int>&, size_t, size_t);
int partition(std::vector<int>&, size_t, size_t);
void quick_sort(std::vector<int>& arr, size_t start, size_t end)
{
if(start < end)
{
int pivot = partition(arr, start, end);
quick_sort(arr, start, pivot);
quick_sort(arr, pivot + 1, end);
}
}
int partition(std::vector<int>& arr, size_t start, size_t end)
{
int x = arr[start];
int i = start;
for(size_t j = start + 1; j < end; j++)
{
if(arr[j]<=x)
{
i=i+1;
std::swap(arr[i], arr[j]);
}
}
std::swap(arr[i], arr[start]);
return i;
}
void print_vector(std::vector<int>& arr)
{
for (size_t i = 0; i < arr.size(); i++)
{
std::cout << arr[i] << " ";
}
std::cout << std::endl;
}
int main()
{
std::vector<int> arr = {10,9,8,7,6,5,4,3,2,1};
int start = 0;
int end = arr.size();
std::cout << "Unsorted array:" << std::endl;
print_vector(arr);
quick_sort(arr, start, end);
std::cout << "Sorted array:" << std::endl;
print_vector(arr);
}
```