static int BinarySearch(int[] a,int target)
{
bool isInclude = false;
int low = 0; //起点
int high = a.Length-1;//终点//为什么-1
int mid;//一次砍一半
while (low<high)
{//如果是low<=high 那么上面high应该是Length 为什么呢 自己可以思考一下
mid = (low + high) / 2;
if (a[mid] < target)//目标值大于终点
{
low = mid + 1;
}
else if (a[mid] > target)
{
high = mid - 1;
}
else {
isInclude = true;
return mid;
}
}
if (isInclude == false) {
Console.WriteLine("没找到 不存在");
}
return -1;
}
static int BinarySearch(int[] arr, int targ