Skip to content

Instantly share code, notes, and snippets.

@kroovysteph
Last active January 24, 2017 20:20
Show Gist options
  • Save kroovysteph/3612a7a86cfeefdd471f7ec8bfaac0c2 to your computer and use it in GitHub Desktop.
Save kroovysteph/3612a7a86cfeefdd471f7ec8bfaac0c2 to your computer and use it in GitHub Desktop.
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