use std::clone::Clone; use std::cmp::PartialOrd; use std::marker::Copy; use std::vec::Vec; fn merge(a: Vec, b: Vec) -> Vec { let mut r = vec![]; let mut i = 0; let mut j = 0; while i < a.len() && j < b.len() { if a[i] < b[j] { r.push(a[i]); i += 1; } else { r.push(b[j]); j += 1; } } while i < a.len() { r.push(a[i]); i += 1; } while j < b.len() { r.push(b[j]); j += 1; } return r; } fn merge_sort(v: Vec) -> Vec { if v.len() <= 1 { return v; } let i = v.len() / 2; let a = merge_sort((&v[..i]).to_vec()); let b = merge_sort((&v[i..]).to_vec()); let r = merge(a, b); return r; } fn mult_bin(a: i64, b: i64) -> i64 { return a * b; } fn main() { println!("Hello, world!"); let l = vec![4, 2, 1, 3]; let l = merge_sort(l); println!("{:?}", l); let r = mult_bin(42, 21); println!("{:?}", r); }