Question: Consider the following incomplete function: def linear search sorted (baby names, target name for name in baby names: return false The above function takes a


Consider the following incomplete function: def linear search sorted (baby names, target name for name in baby names: return false The above function takes a list of sorted baby names and a name as parameters and searches for the given name in the parameter sorted list. The function returns True if the search value is present in the list, and False otherwise. Complete the above function above so that it also returns the total number of elements and total number of equality comparisons (i.e. using needed to search for the given name. Note: You can assume that the sorted list is not empty. You may not use Python's built in index() or find() methods. For example: Test result = linear_search_sorted ( ['Abby', 'Bella', 'Charlotte, "Daisy" "Ella Faith print('Found: {} Length: {} Comparisons:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
