You are on page 1of 7

Presentation on Jump Search

Group Members:

Arsal Khawaja (2k18-ELE-051)


Hasnain Asif (2k18-ELE-053)
Ammar Hassan (2k18-ELE-0 )
Areeb Akhtar (2k18-ELE-0 )
Usman-ul-Haq (2k18-ELE-0 )
Ahmed Shakeel (2k18-ELE-0 )
Jump Search

Jump Search is a searching algorithm for sorted arrays. The


basic idea is to check fewer elements (than linear search) by
jumping ahead by fixed steps or skipping some elements in
place of searching all elements. It creates a block and tries
to find the element in that block. If the item is not in the
block, it shifts the entire block.
The block size is based on the size of the list. If the size of
the list is n then optimal block size will be √n. After finding
a correct block it finds the item using a linear search
technique. The jump search lies between linear search and
binary search according to its performance.
Algorithm

 Step 1: Set i=0 and m = √n.


 Step 2: Compare A[i] with item. If A[i] != item and A[i] <
item, then jump to the next block. Also, do the following:
 Set i = m
 Increment m by √n
 Step 3: Repeat the step 2 till m < n-1
 Step 4: If A[i] > item, then move to the beginning of the
current block and perform a linear search.
1. Set x = i
2. Compare A[x] with item. If A[x]== item, then print x as
the valid location else set x++
3. Repeat Step 4.1 and 4.2 till x < m
 Step 5: Exit
Advantages

 Jump search algorithm is more efficient in case of finding a


element 600 out of 625 elements in an array.
 Jump search algorithm takes 25 iteration to find a element
600 out of 625 elements in an array.
 Whereas Linear search algorithm takes 600 iteration to
find a element 600 out of 625 elements in an array.
 Whereas Binary search algorithm takes 19 iteration to find
a element 600 out of 625 elements in an array but
complexity in calculation is very tough as compared to
jump search algorithm.
Disadvantages

 It’s more complicated than linear search, and is


overkill for very small numbers of elements.
 It works only on lists that are sorted and kept
sorted. That is not always feasible, especially if
elements are constantly being added to the list.
Thank You

You might also like