{
int low,mid,high;
low=0;
high=a.length;
mid=high/2;
while(low<=high) { if(a[mid]>key)
{
high=mid-1;
mid=(low+high)/2;
}
else if(a[mid]
low=mid+1;
mid=(low+high)/2;
}
else
return mid;
}
return -1;
}
Design and implementation of interesting data structures and algorithms. You may find it useful either in your computer science course curriculum or in technical interviews of companies like Microsoft, Amazon, Google, Yahoo, Sun, Oracle etc
No comments:
Post a Comment