1def linear_search(a, key):
2 position = 0
3 flag = False
4 while position < len(a) and not flag:
5 if a[position] == key:
6 flag = True
7 else:
8 position = position + 1
9 return flag
1bool linearsearch(int A[], int N, int X) {
2 for (int i=0; i<N; i++)
3 if (A[i] == X) return true;
4 return false;
5}