# [Solved] : Question 143138

Modify the base case of recursive binary search by performing a linear (sequential) search when the sublist
size becomes less than or equal to 5. Complete the following code:
def searchHybrid(L,x): # Wrapper function
“”” Assumes L is a list sorted in nondecreasing order
returns index of an occurence of x in L if found
else returns -1
Algorithm: hybrid binary-search linear-search”””
def linearSearch(L,x,low,high):
“”” Assumes L is a list sorted in nondecreasing order
returns index of an occurence of x in L[low…high] if found
else returns -1
Algorithm: linear-search”””
….
def recBinarySearchHybrid(L,x,low, high):
1
“”” Assumes L is a list sorted in nondecreasing order
returns index of an occurence of x in L[low…high] if found
else returns -1
Algorithm: hybrid binary-search linear-search: use linear search if size of L[low…high]
is at most 5″””

return recBinarySearchHybrid(L,x,…)

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.