mid_point nearest_mid(ordered_listindex_of_first_elementindex_of_last_elementtermif mid_point index_of_last_element or mid_point index_of_first_elementreturn none if ordered_list[mid_point=termreturn mid_point if term ordered_list[mid_point]index_of_first_element mid_point elseindex_of_last_element mid_point if index_of_first_element index_of_last_elementreturn none the nearest_mid function makes use of multiplication operation this can produce values that are greater than the upper_bound_index or lower than the lower_bound_index when this occursit means the search termtermis not in the list none is therefore returned to represent this so what happens when ordered_list[mid_pointdoes not equal the search themwellwe must now re-adjust the index_of_first_element and index_of_last_element such that the algorithm will focus on the part of the array that is likely to contain the search term this is like exactly what we did in the binary search if term ordered_list[mid_point]index_of_first_element mid_point if the search term is greater than the value stored at ordered_list[mid_point]then we only adjust the index_of_first_element variable to point to the index mid_point