private int BinarySearch(List<int> list,int value)
{
int low =0;
int high = list.Count -1;
int middle =0;
while(low<=high)
{
middle= (high-low)/2+low;
if(list[middle]>value)
high= middle-1;
else if(list[middle]
low= middle+1;
else
return middle;
}
return-1;
}
网友评论