Question: All coding is on PYTHON . INSTRUCTIONS: OUTPUT must bhi same as given in the question. Answer this as soon as possible. 1. Write a
All coding is on PYTHON .
INSTRUCTIONS:
OUTPUT must bhi same as given in the question.
Answer this as soon as possible.

1. Write a recursive function BrainSearch that takes three parameters: an array, starting position, and the number to search. It retums the location of a number if exists in the array, otherwise retums - 1. The function works as per the following recursive definition: If log is greater than number of elements than returns - 1 if element found at location 'loc' in the array then returns the location, Otherwise, perform BrainSearch again for location loc+1 def. Brei Scarsharray, Les, e): 1/ your code goes here Example: array = [11, 12, 13, 41,51] Britainasassh(array, 0, 13) Briobrainasaxsh(array, 0, 6) ) #the function should return 2 -1 2. Write a function RotateRight that rotates an array of size n to the right. The function takes two parameters an integer d which is the amount to rotate by and an array. The function should return the rotated array. def. BetateBight Jarray, d): // your code goes here Example: array = [1,2,3,4,5) d = swtwo rotations print (Betatslight (arba) #the function should return [4, 5, 1,2,3]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
