Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 13 / task6.cpp
blob: 121cc9b3a1b57b7234e3c591f0a4e47043786ed3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
using namespace std;

bool LinearSearch(const int* arr, int len, int searched)
{
	if (len == 0)
		return false;
	return arr[0] == searched || LinearSearch(arr + 1, len - 1, searched);
}

int main()
{
	int arr[] = { 17, 1, 2, 2, 6 };
	cout << LinearSearch(arr, 5, 17);
}