Below is function that does Linear Search:
def linearSearch(arr, targetVal): for i in range(len(arr)): if arr[i] == targetVal: return i return -1
What is the time complexity of Linear Search?
Click here to try again.
This will reset the score of ALL 43 exercises.
Are you sure you want to continue?
Share your score: