Skip to content

Instantly share code, notes, and snippets.

@jayceazua
Last active April 27, 2019 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jayceazua/0ec05a577ed4377067901775ec2b2ce6 to your computer and use it in GitHub Desktop.
Save jayceazua/0ec05a577ed4377067901775ec2b2ce6 to your computer and use it in GitHub Desktop.
def binary_search(array, item):
"""return the index of item in sorted array or None if item is not found"""
array = sorted(array)
return binary_search_iterative(array, item)
def main():
names = [9, 7, 6, 10, 3, 4, 1, 5, 2, 8]
contain = 8
print(binary_search(names, contain))
if __name__ == '__main__':
main()
# CS 1.3 Data Structures and Algorithms - Make School
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment