diff options
1 files changed, 14 insertions, 0 deletions
| -rw-r--r-- | Sem. 12/LinearSearch.cpp | 14 |
diff --git a/Sem. 12/LinearSearch.cpp b/Sem. 12/LinearSearch.cpp new file mode 100644 index 0000000..16e9d1a --- /dev/null +++ b/Sem. 12/LinearSearch.cpp @@ -0,0 +1,14 @@ +#include <iostream> + + +bool linearSearch(const int* arr, unsigned size, int el) +{ + if (size == 0) + return false; + return *arr == el || linearSearch(arr + 1, size - 1, el); +} + +int main() +{ + +} |
