[][src]Function sorting_rs::merge_sort::merge_sort

pub fn merge_sort<T: PartialOrd + Copy>(input: &mut [T])

Sorts a slice out-of-place using Merge sort. All kinds of slices can be sorted as long as they implement PartialOrd.

Examples

let mut slice = vec![3,2,1,4];
sorting_rs::merge_sort(&mut slice);
assert_eq!(slice, &[1,2,3,4]);
let mut strings = vec!["rustc", "cargo", "rustup"];
sorting_rs::merge_sort(&mut strings);
assert_eq!(strings, &["cargo", "rustc", "rustup"]);