logo
pub fn binary_search<T>(arr: &[T], target: &T) -> Result<usize, usize> where
    T: PartialOrd
Expand description

Handmade binary search for a sorted sequence.

This version of binary search does not guarantee retrieval of the leftmost matching position if multiple elements found.

Reference: