Guest User

Untitled

a guest
Jan 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. l=0; r=n-1;
  2. bool nadjen=false;
  3. while(l<=r && nadjen==false)
  4. {
  5. mid=(l+r)/2;
  6. if( broj == niz[mid] ) nadjen=true;
  7. else if( broj<desni[mid] ) r=mid-1;
  8. else l=mid+1;
  9. }
  10. if(nadjen==true) { cnt=mid; while( niz[cnt]==niz[brd-1] ) cnt++; }
  11. else if( niz[l]<broj ) cnt=l+1;
  12. else cnt=l;
Add Comment
Please, Sign In to add comment