Computer Science, asked by narainkumar015, 1 month ago

Algorithum to search an element in an array using linear search method​

Answers

Answered by asajaysingh12890
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 uk0170771
6

Answer:

Linear Search Algorithm

  1. Traverse the array using a for loop.
  2. 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.
  3. If no match is found, return -1 .
Similar questions