#include <set>
using namespace std;
//下面一个移位是一样的,>>相当于除去2,主要是要用right-left,否则对于大数据来说会产生溢出问题。切记
int binarySearch(int arr[],int len,int number)
{
int left=0;
int right=len-1;
int middle;
while (left<=right)
{
middle=left+(right-left)/2;
if (arr[middle]<number)
{
left=middle+1;
}
else if (arr[middle]>number)
{
right=middle-1;
}
else
{
return middle;
}
}