linear search c++ code 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;
}