Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def bin_search(lst, index):
- stub = len(lst) / 2
- if index == lst[stub].id:
- return lst[index]
- elif index > stub:
- return bin_search(lst[stub:], index - stub)
- elif index < stub:
- return bin_search(lst[:stub], index)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement