Algorithum to search an element in an array using linear search method
Answers
Answered by
1
Answer:
Linear Search Algorithm
1-Traverse the array using a for loop.
In every iteration, compare the target value with the current value of the array. 2-If the values match, return the current index of the array. If the values do not match, move on to the next array element.
3-If no match is found, return -1
Answered by
6
Answer:
Linear Search Algorithm
- Traverse the array using a for loop.
- In every iteration, compare the target value with the current value of the array. If the values match, return the current index of the array. If the values do not match, move on to the next array element.
- If no match is found, return -1 .
Similar questions