[][src]Function sorting_rs::stooge_sort::stooge_sort

pub fn stooge_sort<T: PartialOrd>(input: &mut [T])

Sorts a slice in-place using Stooge sort

All kinds of slices can be sorted as long as they implement PartialOrd.

Well, it's a bit faster than slow sort...

Examples

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