Algo
A small crate of commonly used sorting algorithms for any generic type that implements PartialOrd and copy
Usage
= "0.1"
rs_algo
Example
use *;
License
MIT
A small crate of commonly used sorting algorithms for any generic type that implements PartialOrd and copy
[dependencies]
rs_algo = "0.1"
use algo::sort::*;
fn main() {
let mut a = vec![117, 1, 3, 99, 10, 7, 7, 2, 11, -5, 4, 9, 32, 1, 3, 99, 10, 7];
let mut b = vec![117, 1, 3, 99, 10, 7, 7, 2, 11, -5, 4, 9, 817, 1, 3, 99, 10, 7];
let mut c = vec![117, 1, 3, 99, 10, 7, 7, 2, 11, -5, 4, 9, 817, 1, 3, 99, 10, 7];
let mut d = vec!["apple", "cake", "lemon", "zuccini", "berry", "black berry", "kit kat"];
let time = merge::sort_with_time(&mut a);
println!("merge sorted: time {:?}", time);
let time = quick::sort_with_time(&mut b);
println!("quick sorted: time {:?}", time);
let time = insertion::sort_with_time(&mut c);
println!("insertion sorted: time {:?}", time);
let time = bubble::sort_with_time(&mut d);
println!("bubble sorted: time {:?}", time);
}
MIT