Skip to content

Instantly share code, notes, and snippets.

@plucury
Last active July 30, 2016 03:21
Show Gist options
  • Save plucury/63bf8a1970f6ab33c281853db7d7a102 to your computer and use it in GitHub Desktop.
Save plucury/63bf8a1970f6ab33c281853db7d7a102 to your computer and use it in GitHub Desktop.
bsort.py
# coding: utf-8
def bsort(l, start, end, t):
if start == end:
return
m = start + (end - start)/2
if l[m] == t:
return m
if l[m] > t:
return bsort(l, start, m, t)
else:
return bsort(l, m + 1, end, t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment