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 76)
72    fn bubble_sort(&mut self)
73    where
74        T: Ord,
75    {
76        bubble_sort(self, |a, b| a.lt(b));
77    }
78    fn bubble_sort_by<F>(&mut self, mut compare: F)
79    where
80        F: FnMut(&T, &T) -> Ordering,
81    {
82        bubble_sort(self, |a, b| compare(a, b) == Ordering::Less);
83    }