-
-
Save anonymous/88614eca6b7e9e96cfba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
def er_search(l, t, i=0): | |
mid = len(l) / 2 | |
if l[mid] == t: | |
return mid + i | |
elif len(l) == 1: | |
return None | |
return er_search(l[:mid], t, i=i) if l[mid] > t else er_search(l[mid: ], t, i=i+mid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment