[−][src]Function sorts::quick_sort::quick_sort
pub fn quick_sort<T: PartialOrd>(s: &mut [T])
Sorts a slice in-place using quicksort.
Quicksort can be compared to merge sort as it also is a divide-and-conquer algorithm. However, quicksort does all the heavy work before the recursive calls, so it could also be called a conquer-and-divide algorithm. This implementation uses the Lomuto partition scheme.
Examples
let mut vec = vec![0, -1, -2, -3,]; sorts::quick_sort(&mut vec); assert_eq!(vec, &[-3, -2, -1, 0]);