A programmer is writing a Python-style algorithm to carry out a binary search on a sorted list of book registration IDs, book_ids, to locate a specific ID stored in search_id.
The programmer has started writing the script but has left some lines blank.
def binary_search(book_ids, search_id):
start = 0
end = len(book_ids) - 1
found = False
# Line 5: Initialize the comparisons counter
____________________
while start <= end and not found:
# Line 8: Increment the comparisons counter
____________________
# Line 10: Calculate the middle index (using integer division)
____________________
if book_ids[middle] == search_id:
found = True
elif search_id < book_ids[middle]:
# Line 15: Adjust the end pointer
____________________
else:
# Line 17: Adjust the start pointer
____________________
return found, comparisons
Amend the code by providing the correct statements to fill the blank spaces on:
Maintain the correct logic of a binary search and track the loop execution count.