pub fn flash_sort<T>(arr: &mut [T], get_key: fn(&T) -> i32)
Expand description
Flash Sort is an algorithm that use the strategy that you can compute the approximate final position directly from the element value, with no comparisons.
ยงExamples
extern crate sort_algorithms;
use sort_algorithms::flash_sort;
let mut arr = vec![7, 6, 5, 2, 4, 3, 1, 0, -1];
flash_sort(&mut arr, |&a| a);
assert_eq!(arr, [-1, 0, 1, 2, 3, 4, 5, 6, 7]);