折半查找 Posted on 2018-10-14 | In 算法 | 123456789101112131415161718public void search(int[] array,int key){ int low,high,mid; low=0; high=array.length-1; while(low<=high){ mid=(low+high)/2; if(array[mid]>key){ high=mid-1; } else if(array[mid]<key){ low=mid+1; } else if(array[mid]==key){ return mid; } }}