Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 12 / LinearSearch.cpp
diff options
context:
space:
mode:
1 files changed, 14 insertions, 0 deletions
-rw-r--r--Sem. 12/LinearSearch.cpp14
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()
+{
+
+}