Given an array arr[] of n elements, write a function to search a given element x in arr[].
A simple approach is to do linear search, i.e
1.Start from the leftmost element of arr[] and one by one compare x with each element of arr[]
2.If x matches with an element, return the index.
3.If x doesn’t match with any of elements, return -1.
Linear search is rarely used practically because other search algorithms such as the binary search algorithm and hash tables allow significantly faster searching comparison to Linear search.