Skip to main content

interpolation_search

Function interpolation_search 

Source
pub fn interpolation_search(arr: &[i64], target: i64) -> Result<usize, Error>
Expand description

Interpolation search for numeric data.

arr must be sorted in ascending order (caller contract, checked with debug_assert! in debug builds). Returns Ok(index) of the target, or Err(Error::NotFound) if absent.