2018-10-12 15:37:13 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								title: Jump Search
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								## Jump Search
  
						 
					
						
							
								
									
										
										
										
											2018-12-14 10:03:29 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-12 21:22:49 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								A jump search locates an item in a sorted array by jumping k items in the array and then verifies if the item wanted is between the previous jump and current jump.
							 
						 
					
						
							
								
									
										
										
										
											2018-10-12 15:37:13 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-12 21:22:49 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# Worst Case Complexity
  
						 
					
						
							
								
									
										
										
										
											2018-10-12 15:37:13 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								O(√N)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-11-12 21:22:49 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# How does it work ?
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Define the value of k, the number of jumps: The optimal jump size is √N where N is the length of the sorted array. 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								2.  Jump over the array elements by k everytime, checking the following condition `Array[i] < valueWanted < Array[i+k]` . 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								3.  If the previous condition is true, then do a linear search between `Array[i]`  and `Array[i + k]` . 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								4.  Return the position of the value if it is found in the array. 
						 
					
						
							
								
									
										
										
										
											2018-10-12 15:37:13 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Code 
  
						 
					
						
							
								
									
										
										
										
											2018-11-12 21:22:49 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								To view examples of code implementation for this method, access this link below:
							 
						 
					
						
							
								
									
										
										
										
											2018-10-12 15:37:13 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-14 10:03:29 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								[Jump Search - OpenGenus/cosmos ](https://github.com/OpenGenus/cosmos/tree/master/code/search/src/jump_search )
							 
						 
					
						
							
								
									
										
										
										
											2018-10-12 15:37:13 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# Credits
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[The logic's array image ](http://theoryofprogramming.com/2016/11/10/jump-search-algorithm/ )