data={1,2,3,4,5,6,7,8,9,10,11,12};
max=12;min=0;req=5;
while(max>=min)
{
mid=(max+min)/2;
else if(data[mid]>req)
max=mid;
else if(data[mid]<req)
min=mid;
}
max=12;min=0;req=5;
while(max>=min)
{
mid=(max+min)/2;
if(data[mid]=req)
retrun mid;else if(data[mid]>req)
max=mid;
else if(data[mid]<req)
min=mid;
}