0
How can i apply the linear search algorithm to this code ?
3 Answers
0
Oh yes she is my friend ,
Can you help us please How can we write it?
we need to apply the linear search algorithm to it
For example :
Given: A list of N elements, and the target
1. index 0
2. Repeat steps 3 to 5
3.Compare target with list[index]
4.if target = list[index] then
return index // success
else if index >= N - 1
return -1 // failure
5.index index + 1
We take this example in college Martin Taylor