Question: 4. [10 points Consider the following functions def any_func_in_list linear (1st): for num in lst: funcnum = func (num) if linear-search(funcnum, lst): return True return

 4. [10 points Consider the following functions def any_func_in_list linear (1st):

4. [10 points Consider the following functions def any_func_in_list linear (1st): for num in lst: funcnum = func (num) if linear-search(funcnum, lst): return True return false def any_func_in_list_binary (1st): radix_sort (1st) # Assume 0(n) for num in lst: funcnum - func (num) if binary_search (funcnum, lst): return True return false Where linear search and binary-search are as discussed in class but modified to return True if the element is in the list and False if it is not found. Assume that radix_sort runs in O(n) time it is not a comparison sort), and that func runs in O(1) time. (a) (2 points What is the best-case (in Big-O form) of any_func_in_list_linear (please also list what that best case is) (b) [4 points What is the worst-case runtime (in Big-O form) of any_func_in_list_linear (please also list what that worst case is) (c) (4 points) What is the worst-case runtime (in Big-O form) of any_func_in_list_binary (please also list what that worst case is)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!