Skip to main content

bubble_sort

Function bubble_sort 

Source
fn bubble_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 28)
24    fn bubble_sort(&mut self)
25    where
26        T: Ord,
27    {
28        bubble_sort(self, |a, b| a.lt(b));
29    }
30    fn bubble_sort_by<F>(&mut self, mut compare: F)
31    where
32        F: FnMut(&T, &T) -> Ordering,
33    {
34        bubble_sort(self, |a, b| compare(a, b) == Ordering::Less);
35    }