daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Mar 15th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public int itemIndex(Integer val) {
  2.         int laag, hoog;
  3.         hoog = this.sil.size()-1;
  4.         laag = 0;
  5.         while(laag < hoog){
  6.                 int midden = (laag+hoog)/2;
  7.                 if(sil.get(midden) < val){
  8.                         laag = midden+1;
  9.                 } else {
  10.                         hoog = midden-1;
  11.                 }
  12.         }
  13.         return laag;
  14. }  
  15.  
  16.  
  17.  Test: itemIndex
  18.         [0, 2, 4, 4, 8].itemIndex(4)
  19.             Verwacht:  2
  20.             Werkelijk: 1
  21.         [0, 2, 4, 4, 8].itemIndex(9)
  22.             Verwacht:  5
  23.             Werkelijk: 4
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top