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

```
fn _partition<T: Ord>(arr: &mut [T], lo: isize, hi: isize) -> isize {
let pivot = hi as usize;
let mut i = lo - 1;
let mut j = hi;
loop {
i += 1;
while arr[i as usize] < arr[pivot] {
i += 1;
}
j -= 1;
while j >= 0 && arr[j as usize] > arr[pivot] {
j -= 1;
}
if i >= j {
break;
} else {
arr.swap(i as usize, j as usize);
}
}
arr.swap(i as usize, pivot as usize);
i
}
fn _quick_sort<T: Ord>(arr: &mut [T], lo: isize, hi: isize) {
if lo < hi {
let p = _partition(arr, lo, hi);
_quick_sort(arr, lo, p - 1);
_quick_sort(arr, p + 1, hi);
}
}
pub fn quick_sort<T: Ord>(arr: &mut [T]) {
let len = arr.len();
_quick_sort(arr, 0, (len - 1) as isize);
}
```