pub fn Binary_search(array: Vec<i32>, target: i32) -> Option<usize>
Expand description

Perform a binary search on a sorted array of integers.

§Arguments

  • array: A sorted vector of integers.
  • target: The integer value to search for in the array.

§Returns

Option<usize>: Returns Some(index) if target is found in array, where index is the index of the target in the array. Returns None if target is not found in the array.