Sha256: a7954d771958fd7dfd412ec833f91a3454089d2158854a7f9fe216ddcc03f6bb
Contents?: true
Size: 509 Bytes
Versions: 69
Compression:
Stored size: 509 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
69 entries across 69 versions & 1 rubygems