Linear search (sequential search)
Method for finding an element within a list. It sequentially checks each element of the list until a match is found, or the whole list has been searched.
A linear search runs in at worst linear time and makes at most comparisons, where is the length of the list. If each element is equally likely to be searched, then linear search has an average case of comparisons, but the average case can be affected if the search probabilities for each element vary.
Linear search is rarely practical because other search algorithm and schemes, such as the binary search and hash table, allow significantly faster searching for all but short lists.
— Wikipedia
Linear search usually inefficient. For example, if we have a list of 1000 elements, and we want to find the element with value 1000, we will have to check all 1000 elements. But if we have some feedback when we get some element, finding element can be much more efficient.
In best case linear search take ==1 step or ==.
In the worst case linear search take as many steps as ==there are elements == in the array.
If there are data elements, how many steps will linear search algorithm
take in the worst case?
Algorithm will take steps in the worst case.