#include<iostream>
using namespace std;
int bs(int a[],int num)
{
int i=0,j=9;
while(i<=j)
{
int mid=(i+j)/2;
if(a[mid]=num) return mid;
else if(a[mid]>num) j=mid-1;
else i=mid+1;
}
return -1;
}
int bsc(int a[],int num,int i,int j)
{
int mid=(i+j)/2;
if(i>j) return -1;
else if (a[mid]=num) return mid;
else if (a[mid>num]) return bsc(a,num,i,mid-1)
else return return bsc(a,num,mid+1,j)
}
int main()
{
int a[]={1,2,3,4,5,6,7,8,9,10};
int num=2;
cout << bs(a,num) << endl;
cout << bsc(a,num,0,8)<< endl;
}