Question: The code is in python: def search(n,h): return bSearch(n,h,0,len(h)-1) def bSearch(n,h,start,stop): return False #Do not make changes below this line. import random print(Welcome to Binary

The code is in python:

def search(n,h): return bSearch(n,h,0,len(h)-1) def bSearch(n,h,start,stop): return False
#Do not make changes below this line. import random print("Welcome to Binary Search Test") x=input("Enter Seed to Test: ") random.seed(x) target=random.randint(0,30) list=[random.randint(0,30) for x in range(0,20)] list.sort() print("Looking for",target) print("In list",list) x = search(target,list) if x==True: print("Target was found.") else: print("Target was not found.") 
2.5 Binary Search Complete the Python3 implementation of the Binary Search Algorithm given below. Each time you compare the needle to an element in the haystack, print out what you are comparing. Here is an example execution Welcome to Binary Scarch Test Enter Seed to Test: 12 Looking for 18 4, 5, 7, 9, 11, 11, 13, 14, 16, 18, 20, 20, 21, 21, 22, 23, 30, 30] In list [0, 3, Comparing element 14 to needle 18 Comparing element 21 to needle 18 Comparing element 18 to needle 18 Target was found. The Pseudocode from lecture is given below as a guide. function bsearch (n,h,start,stop) if stop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
