Sha256: 512db2ea61c7b90d5361a5097fe83ff14e32954dea0df742b1c5f6e5d1f1c6ab
Contents?: true
Size: 510 Bytes
Versions: 327
Compression:
Stored size: 510 Bytes
Contents
defmodule BinarySearch do @doc """ Searches for a key in the tuple using the binary search algorithm. It returns :not_found if the key is not in the tuple. Otherwise returns {:ok, index}. ## Examples iex> BinarySearch.search({}, 2) :not_found iex> BinarySearch.search({1, 3, 5}, 2) :not_found iex> BinarySearch.search({1, 3, 5}, 5) {:ok, 2} """ @spec search(tuple, integer) :: {:ok, integer} | :not_found def search(numbers, key) do end end
Version data entries
327 entries across 327 versions & 1 rubygems