pub fn interpolation_search(arr: &[i32], target: &i32) -> Result<usize, usize>
Expand description
Search in sorted sequences by checking the next position based on an linear interpolation of the search key.
§Parameters
arr
: Slice to search in.target
: Object to search for.
§Notes
Since interpolations only be applied on numeric types, we choose i32
to
avoid overkilling. If you desire a full functional trait of numeric types,
num crate would meet your needs.