while(low<=high)
{
  int mid=low+(high-low)/2
  if (key==arr[mid]){ 
      return  mid;
   }
  else 
  {
     if (key>arr[mid])
     {
         low=mid+1;
     }
     else
     {
         high=mid-1;
     }
  }
}