Last active
January 24, 2017 20:20
-
-
Save kroovysteph/3612a7a86cfeefdd471f7ec8bfaac0c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void remove(String s) { | |
if(!this.contains(s)) { | |
return; | |
} | |
int bucketNr = hash(s) % N; | |
Item old = null; | |
Item cur = buckets[bucketNr]; | |
if (cur == null) return; | |
if ( s.equals(cur.value) ) { | |
old = cur; | |
cur = cur.next; | |
} else { | |
while( !s.equals(cur.value) ) { | |
old = cur; | |
cur = cur.next; | |
} | |
} | |
//umbiegen | |
old.next = cur.next; | |
n--; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment