binary_search

Functions

pub fn perform(
  list_of_sorted_numbers: List(Int),
  value_to_search: Int,
) -> Int

Perform a binary search on a list of sorted numbers(Int). Returns the index of the value in the list if it is found, otherwise -1, indicating not found..

Example

> binary_search.perform([1, 2, 3, 4, 5], 3) # returns 2
Search Document