mod merge_sort; use crate::merge_sort::merge_sort_inversions; use std::fs::File; use std::io; use std::io::{BufRead, BufReader, Error, ErrorKind}; use std::vec::Vec; fn read_to_vector(path: &str) -> Result, io::Error> { let file = File::open(path)?; let br = BufReader::new(file); let mut v = Vec::new(); for line in br.lines() { let line = line?; let n = line .trim() .parse() .map_err(|e| Error::new(ErrorKind::InvalidData, e))?; v.push(n); } Ok(v) } fn c1a2() { let vec = read_to_vector("data/week_2_assignment_2.txt").unwrap(); let (_sorted, inversions) = merge_sort_inversions(vec); // println!("{:?}", sorted.len()); println!("course 1 assignment 2: {:?}", inversions); } fn main() { c1a2(); }