Linear search can be used to search for a desired value in a list. It achieves this by examining each of the elements and comparing it with the search element starting with the first element to the last element in the list until it finds a match.
The steps are:
For example, we can use the linear search algorithm to find the target value 22 in a list. The algorithm iteratively moves through the list until it finds a 22 in the 7th position of the list.
Use linear search to find 23 in the list of numbers on the right. It appears twice. Would linear search stop when it reaches the third element or ninth element of the list?