Skip to main content

select

Function select 

Source
pub fn select<T>(
    x: &mut [T],
    ranks: &[usize],
    compare: impl Fn(&T, &T) -> Ordering + Copy,
)
Expand description

Places each of the sorted, distinct ranks at its sorted position, leaving the runs between them unordered. Ranks must be below x.len(). Selecting the middle requested rank first partitions disjoint runs for the remaining ranks; one rank takes linear time.