Skip to main content

insertion_sort

Function insertion_sort 

Source
fn insertion_sort<T, F>(v: &mut [T], is_less: F)
where F: FnMut(&T, &T) -> bool,
Examples found in repository?
crates/competitive/src/algorithm/sort.rs (line 100)
96    fn insertion_sort(&mut self)
97    where
98        T: Ord,
99    {
100        insertion_sort(self, |a, b| a.lt(b));
101    }
102    fn insertion_sort_by<F>(&mut self, mut compare: F)
103    where
104        F: FnMut(&T, &T) -> Ordering,
105    {
106        insertion_sort(self, |a, b| compare(a, b) == Ordering::Less);
107    }