Amity
Tagging Lab — Binary Search
“Find it fast before it swims off the page.” — Hooper
Challenge:
The shark tagging database has thousands of sorted tag IDs. Find a tag fast using binary search.
Research Station • Data Index
Task:
Implement
binary_search(sorted_list, target)
.
Return the index if found, otherwise
-1
.
Click
Run Unit Tests
. If all tests pass, you'll get the flag.
def binary_search(sorted_list, target): """Return index of target in sorted_list using binary search, or -1 if not found.""" # Your code here return -1 # Test runner do not edit below run_selected_test()
Run Unit Tests
Output or flag will appear here...