Advertisement
istinishat

binary_search

Apr 28th, 2017
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int binary_serach(){
  2.     int l,r;
  3.     //l points to true, and r points to false
  4.     while(r-l>1){
  5.         int mid=(l+r)/2;
  6.         if(f(mid))
  7.             l=mid;
  8.         else r=mid
  9.     }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement