fn _insertion_sort<T, F>(array: &mut [T], left: usize, right: usize, compare: F)
where
    T: std::cmp::Ord + std::clone::Clone,
    F: Fn(&T, &T) -> std::cmp::Ordering + std::clone::Clone,
{
    for i in (left + 1)..=right {
        let temp = array[i].clone();
        let mut j = (i - 1) as isize;

        while j >= left as isize
            && compare(&array[j as usize], &temp) == std::cmp::Ordering::Greater
        {
            array[(j + 1) as usize] = array[j as usize].clone();
            j -= 1;
        }
        array[(j + 1) as usize] = temp;
    }
}
// This function sorts array from left index to
// to right index which is of size atmost RUN
This function sorts array from left index to
to right index which is of size atmost RUN
This function sorts array from left index to to right index which is of size atmost RUN
fn _insertion_sort<T, F>(array: &mut [T], left: usize, right: usize, compare: F)
where
    T: std::cmp::Ord + std::clone::Clone,
    F: Fn(&T, &T) -> std::cmp::Ordering + std::clone::Clone,
{
    for i in (left + 1)..=right {
        let temp = array[i].clone();
        let mut j = (i - 1) as isize;
        while j >= left as isize
            && compare(&array[j as usize], &temp) == std::cmp::Ordering::Greater
        {
            array[(j + 1) as usize] = array[j as usize].clone();
            j -= 1;
        }
        array[(j + 1) as usize] = temp;
    }
}
fn _insertion_sort < T , F > ( array : & mut [ T ] , left : usize , right : usize , compare : F ) where T : std :: cmp :: Ord + std :: clone :: Clone , F : Fn ( & T , & T ) -> std :: cmp :: Ordering + std :: clone :: Clone , { for i in ( left + 1 ) ..= right { let temp = array [ i ] . clone ( ) ; let mut j = ( i - 1 ) as isize ; while j >= left as isize && compare ( & array [ j as usize ] , & temp ) == std :: cmp :: Ordering :: Greater { array [ ( j + 1 ) as usize ] = array [ j as usize ] . clone ( ) ; j -= 1 ; } array [ ( j + 1 ) as usize ] = temp ; } }
This function sorts array from left index to
to right index which is of size atmost RUN
This function sorts array from left index to to right index which is of size atmost RUN
array
&mut [T]
left
usize
right
usize
compare
F
array
&mut [T]
left
usize
right
usize
compare
F