Linear search (also known as sequential search) is a 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.
procedure linear_search(array : list of items to search, n : length of list, search_key : key to search for)
i ← 0
while i < n
if search_key == array[i]
return i
end if
i ← i + 1
end while
return -1
end procedureTime Complexity: O(n)