[][src]Function buldak::radix::sort_reverse

pub fn sort_reverse<T>(array: &mut [T], radix: usize, digits_max: usize) where
    T: TryInto<isize> + TryFrom<isize> + Clone,
    <T as TryInto<isize>>::Error: Debug

Sort in descending order using a radix algorithm.

The parameter 'radix' is ​​the base on which to sort. If you want decimal based sorting, you can pass 10.

The parameter 'digits_max' is the maximum number of digits in the array. For example, if the maximum number in the array does not exceed 9999, you can pass 4. Any value beyond this number will cause an error.

use buldak::radix;

let mut nums = [1, 4, 2, 3, 5, 111, -33, 234, 21, 13];
radix::sort_reverse(&mut nums, 10, 4);
assert_eq!(nums, [234, 111, 21, 13, 5, 4, 3, 2, 1, -33]);