Question: Write a function called modified_binary_search that will take a list, a value, a lower range, and an upper range as arguments. Then, perform the binary

Write a function called modified_binary_search that will take a list, a value, a lower range, and an upper range as arguments. Then, perform the binary search in the specified range (From lower range to upper range) of that list. If the value is found in the specified range of the list, then return the index of the FIRST occurrence of the value If the value is not found in the specified range of the list, then return -99999 You will only search in the specified range; you must not search beyond the specified range.

================================================ Function Call 1: print(modified_binary_search([2,3,5,6,6,11,13,15,19,21,44,49,56],19, 1, 11)) Sample Output 1: 8 ================================================ Function Call 2: print(modified_binary_search( [2,3,5,6,6,11,13,15,19,21,44,49,56], 6, 1, 11)) Sample Output 2: 3 ================================================ Function Call 3: print(modified_binary_search( [2,3,5,6,6,11,13,15,19,21,44,49,56], 56, 1, 8)) Sample Output 3: -99999 ================================================ Function Call 4: print(modified_binary_search([2,3,5,6,6,11,13,15,19,21,44,49,56],48, 1,11)) Sample Output 4: -99999

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!