pub mod insertion_sort; pub mod dual_pivot_quick_sort; pub mod hybrid_sort; pub mod merge_sort; pub mod my_sort; pub mod quick_sort; pub trait Sort { fn new(should_print: bool) -> Self; fn sort_mut(&mut self, list: &mut Vec); fn sort(&mut self, list: &Vec) -> Vec { let mut list = list.clone(); self.sort_mut(&mut list); list } fn num_comp(&self) -> u64; fn num_swap(&self) -> u64; fn reset_state(&mut self); } #[derive(PartialEq)] pub enum CompareResult { LESS, EQUAL, GREATER } pub fn is_sorted(list: &[u64]) -> bool { for i in 0..(list.len() - 1) { if list[i] > list[i + 1] { return false; } } true }