Question: python language Exercises Problem 1 Write a program that uses a function called binary_Isearch() that takes a list and a search key and returns the

python language python language Exercises Problem 1 Write a program that uses a function

Exercises Problem 1 Write a program that uses a function called binary_Isearch() that takes a list and a search key and returns the index of the search key. If it does not exist, return-1. This function must use iteration. The following is the main part of your program. Your task is to create the function. #create the function here import random, time #I mean create the function here ... really # main largeList = range (5000, 20000) largeList largeList[:: 3] largeMixedList = random sample (largeList, len (largeList)) # Do NOT print the list here # choose a number between 5000 and 20000 key = 9872 # or use a random generator to get a number timel = time. perf_counter() # or time.time() res = binary_Isearch (largeMixedList, key) # calling the function here time2 = time. perf_counter() if res == -1: print("The search key", key, "could not be found in the list.") else: print("The search key", key, "was found at position", res) print("It took", time2-timel) QATAR Problem 2 Write a program that uses a function called binary_Rsearch() that takes a list and a search key and returns the index of the search key. If it does not exist, return-1. This function must use recursion. Your task is to create the function. Use the main section in the previous problem. Problem 3 Write a program that uses a function called linear_search() that takes a list and a search key and returns the index of the search key. If it does not exist, return-1. This function must use linear search. Your task is to create the function. Use the main section in the previous

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!