Linear Search
A linear search, also known as a sequential search, is a method of finding an element within a list. It checks each element of the list sequentially until a match is found or the whole list has been searched.
Algorithm
- Start from the leftmost element of arr[] and one by one compare with each element of arr[].
- If x matches with an element, return the index.
- If x doesn't match with any of the elements, return -1.