Last active
February 2, 2020 18:13
-
-
Save PaperDevil/53be5954c6e9579c6712f23b0525d1b9 to your computer and use it in GitHub Desktop.
Revisions
-
PaperDevil revised this gist
Feb 2, 2020 . No changes.There are no files selected for viewing
-
PaperDevil revised this gist
Feb 2, 2020 . No changes.There are no files selected for viewing
-
PaperDevil created this gist
Feb 2, 2020 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ def binary_search(area, item): mid = len(area) // 2 low, high = 0, len(area) - 1 while low <= high: if area[mid] == item: return mid if item > area[mid]: low = mid + 1 else: high = mid - 1 mid = (low + high) // 2 return None