public static int CompromiseFind(int [] arr,int key)
{
for (int i =0;i<arr.length ;i++ )
{
int min,max,mid;
min=0;
max=arr.length;
mid=(0+arr.length)/2;
if (arr[mid]>key)
{
max=mid;
}
else
{
min=mid;
}
if (max<min)
{
return mid;
}
}
return -1;
}
{
for (int i =0;i<arr.length ;i++ )
{
int min,max,mid;
min=0;
max=arr.length;
mid=(0+arr.length)/2;
if (arr[mid]>key)
{
max=mid;
}
else
{
min=mid;
}
if (max<min)
{
return mid;
}
}
return -1;
}