[−][src]Function sorting_rs::nheap_sort::nheap_sort
pub fn nheap_sort<T: PartialOrd>(input: &mut [T])
Sorts a slice in-place using N-heap sort
All kinds of slices can be sorted as long as they implement
PartialOrd
.
3 children are a bit more effective than 2, though 4 and more are generally less effective, but you can modify this parameter by editing souces.
Examples
let mut vec = vec![5,3,2,4]; sorting_rs::nheap_sort(&mut vec); assert_eq!(vec, &[2,3,4,5]);
let mut strings = vec!["rustc", "cargo", "rustup"]; sorting_rs::nheap_sort(&mut strings); assert_eq!(strings, &["cargo", "rustc", "rustup"]);