pub fn sort<T: Sortable>(list: &mut [T])Expand description
Merge sorts stable, not in-place, in ascending order a mutable ref slice of type T: Sortable
Merge sort is an efficient divide and conquer sort. Conceptually, a merge sort works as follows: Divide the unsorted list into n sublists, each containing 1 element (a list of 1 element is considered sorted). Repeatedly merge sublists to produce new sorted sublists until there is only 1 sublist remaining. This will be the sorted list.
ยงExamples
use rust_sort::merge_sort::sort;
let mut arr = [3, 2, 1, 7, 9, 4, 1, 2];
sort(&mut arr);
assert_eq!(arr, [1, 1, 2, 2, 3, 4, 7, 9]);