[][src]Function algos::sort::merge

pub fn merge<T: Copy + PartialOrd, C: Fn(&T, &T) -> bool>(v: &mut [T], cmp: &C)

Merge Sort: Sort v slice according to the way you define the cmp parameter.

This sort is stable.

CaseTime complexitySpace complexity
Best:Ω(nlog(n))
Avrg:Θ(nlog(n))
Worst:O(nlog(n))O(n)

Example

use algos::sort;

let mut v = [9, 3, 5, 7, 8, 7];
// Crescent sorting
sort::merge(&mut v, &|v, b| v < b);