Function heapsort

Source
pub fn heapsort<T>(arr: &mut [T])
where T: Copy + Clone + PartialEq + PartialOrd,
Expand description

Heap sort is an generalist algorithm that use the strategy order by selecion.

ยงExamples

extern crate sort_algorithms;
use sort_algorithms::heapsort;


let mut arr = vec![7, 6, 5, 2, 4, 3, 1, 0];
heapsort(&mut arr);
assert_eq!(arr, [0, 1, 2, 3, 4, 5, 6, 7]);