jump search algorithm
- by davit-datuashvili
i am doing jump search algorithm but it show me that element is not in array while it is
here is code
import java.math.*;
public class jamp {
public static int min(int a,int b){
return a
}
public static void main(String[]args){
int a[]=new int[]{3,7,9,12,14,15,16,17,18};
int l=14;
System.out.println(jumpsearch(a,a.length,l));
}
public static int jumpsearch(int a[],int n, int l ){
int t=0;
int b=(int)Math.sqrt(n);
while (a[min(b,n)-1]=n) return -1 ;
}
while (a[t]
return -1 ;
if ( a[t]==l) {
return t;
}
}
return -1;
}
}
please help