void BinSearch(SqList* sql, EleType x) //二分查找应用于已经排序好的数据

{

assert(sql);

if(sql->size > 0)

{

int left = 0;

int right = sql->size - 1;

int mid = left + (right - left) / 2;  //此处mid写法 防止溢出

while(left<=right)       

        {

    

if(sql->arr[mid] > x)

{

right = mid - 1;

}

else if(sql->arr[mid] < x)

{

left = mid + 1;

}

else

{

printf("%d",mid);

break;

}

}

 

}


}