Skip to main content

go_search

Function go_search 

Source
fn go_search(n: usize, f: impl Fn(usize) -> bool) -> usize
Expand description

Go’s sort.Search: the smallest index in [0, n) where f holds, or n, found by the same bisection, so a predicate that is not monotonic (NaN counts) picks the same index.