Function approx_pearson_skew::kth_ind[][src]

pub fn kth_ind(slice: &[u8], k: usize) -> Option<usize>

Find kth value index from unsorted immutable slice

Using a O(1) size, but O(nk) time method, worst case O(n^2).

let arr = [0, 2, 5, 7, 2, 1];
let ind = kth_ind(&arr, 3).unwrap();
assert_eq!(arr[ind], 2);