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.
w3exercise_input_no_0
Completed 0 of 43 Exercises:
This will reset the score of ALL 43 exercises.
Are you sure you want to continue?
Share your score: