write a program implements linear search for successful and unsuccessful search code example
Example: linear search in c++
bool linearsearch(int A[], int N, int X) {
for (int i=0; i<N; i++)
if (A[i] == X) return true;
return false;
}
bool linearsearch(int A[], int N, int X) {
for (int i=0; i<N; i++)
if (A[i] == X) return true;
return false;
}