algos/src/main.rs

20 lines
294 B
Rust
Raw Normal View History

use std::vec::Vec;
use std::clone::Clone;
fn merge_sort<T: Clone>(v: Vec<T>) -> Vec<T> {
if v.len() <= 1 {
return v;
}
let sorted = v.to_vec();
return sorted;
}
fn main() {
println!("Hello, world!");
let l = vec![2,1,3];
let l = merge_sort(l);
println!("{:?}", l);
}