Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. def bin_search2(arr,value, left, right):
  2.   mid = int((left + right) / 2)
  3.   guess = arr[mid]
  4.   if guess == value:
  5.     return mid
  6.   if guess < value:
  7.     left = mid + 1
  8.     return bin_search2(arr,value, left, right)
  9.   if guess > value:
  10.     right = mid - 1
  11.     return bin_search2(arr,value, left, right)
  12.   return None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement