Question: How many iterations are needed for the function to find 1 2 ? def Find ( list , ele, low, high ) : if high

How many iterations are needed for the function to find 12?
def Find(list, ele, low, high):
if high >= low:
mid =(high + low)//2
if list[mid]== ele:
return mid
elif list[mid]> ele:
return Find(list, ele, low, mid-1)
else:
return Find(list, ele, mid +1, high)
else:
return -1
listOfNumbers =[11,12,13,15,18]
result = Find(listOfNumbers,12,0,(len(listOfNumbers)-1))
print(result)
Question 7 options:
4
3
2
1

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!