write an algorithm to search an element in an array using linear search method
Answers
Answered by
20
Answer:
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.
Answered by
0
Explanation:
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
English,
1 month ago
Math,
2 months ago
Social Sciences,
2 months ago
Social Sciences,
9 months ago
Math,
9 months ago