Function selection_sort

Source
pub fn selection_sort<T>(arr: &mut [T], compare: fn(T, T) -> bool)
where T: Copy + Clone,
Expand description

Selection Sort is an algorithm that use order by selection. !important only positive keys

ยงExamples

extern crate sort_algorithms;
use sort_algorithms::selection_sort;

let mut arr = vec![7, 6, 5, 2, 4, 3, 1, 0];
selection_sort(&mut arr, |a, b| a < b);
assert_eq!(arr, [0, 1, 2, 3, 4, 5, 6, 7]);