Function out::max_unstable

source ·
pub fn max_unstable<T: Ord>(v: &mut [T], n: usize) -> &mut [T] 
Expand description

Get the n largest items.

This method is not stable, i.e. it may not preserve the order of equal elements.

Examples

let mut v = [-5, 4, 1, -3, 2];
let max = out::max_unstable(&mut v, 3);
assert_eq!(max, [1, 2, 4]);