From 28818683974ad4d7e4ceed738d23168c2ce3a76a Mon Sep 17 00:00:00 2001 From: Sunaina Agarwal <56354115+Sunainacode@users.noreply.github.com> Date: Tue, 5 Oct 2021 23:04:25 +0530 Subject: [PATCH 1/2] Create jump_search.cpp --- Jump Search/jump_search.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Jump Search/jump_search.cpp diff --git a/Jump Search/jump_search.cpp b/Jump Search/jump_search.cpp new file mode 100644 index 0000000..d9abf2a --- /dev/null +++ b/Jump Search/jump_search.cpp @@ -0,0 +1,33 @@ +#include +#include +using namespace std; +int main(){ + int n; + cout<<"Enter the number of elements: "; + cin>>n; + cout<<"Enter the elements in the sorted order: "; + int a[n]; + for(int i=0;i>a[i]; + } + int d; + cout<<"Enter the element to search: "; + cin>>d; + int x,i; + cout<<"Enter the skip count: (Preferred: "<>x; + for(i=0;id){ + break; + } + } + for(int t=i;t Date: Tue, 5 Oct 2021 23:05:25 +0530 Subject: [PATCH 2/2] Create readme.md --- Jump Search/readme.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Jump Search/readme.md diff --git a/Jump Search/readme.md b/Jump Search/readme.md new file mode 100644 index 0000000..727a964 --- /dev/null +++ b/Jump Search/readme.md @@ -0,0 +1,3 @@ +

Jump Search

+Jump Search is a faster algorithm than Binary search. It is just a modified form of binary search where a small range of numbers are found in which the desired number lies by jumping some indexes in between. Then the desired index is found out by using linear search in that particular small range. The number of indices jumped is preferred to be the square root of the length of array.
+Time Complexity: O(n/m + (m-1)) where n is the length of array and m is the jump size.