普通及递归法实现二分法
//二分查找
public class test01 {
public static int search(int[] arr,int n,int x){//普通二分查找
//找到X返回在数组中的位置,否则返回-1
int left=0;
int right =n;
while(leftmid)
left=mid+1;
else
right=mid-1;
}
return -1;
}
public static int Search(int[] arr,int left,int right,int x){///递归法实现二分法
int mid=(left+right)/2;
if(left<=right){
if(x==arr[mid])
return mid;
else if(x>arr[mid])
return Search(arr,mid+1,right,x);
else if(x



