Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
def search(arr, t)
min = 0
max = arr.count -1
mid = (max-min)/2
if arr.count == 0 || (arr.count == 1 && arr[0] != t)
return -1
elsif t <= arr[mid]
return search(arr[0..mid], t)
else
return mid + search(arr[mid..-1], t)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.