Created
October 29, 2012 00:41
-
-
Save arn-e/3970715 to your computer and use it in GitHub Desktop.
binary_search_abridged
This file contains hidden or 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
| def bs(i,a,m=0,x=a.size,h=(m+x)/2,l=a.size) | |
| i==a[m]?m:(i<a[0]||i>a[l-1])||m==x-1?-1:i<a[h]?bs(i,a,m,h):bs(i,a,h,l) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment