Skip to content

Instantly share code, notes, and snippets.

@lubaochuan
Created April 29, 2020 21:37
Show Gist options
  • Save lubaochuan/e9f1b2fb77f9271cad2078a80e77fd4c to your computer and use it in GitHub Desktop.
Save lubaochuan/e9f1b2fb77f9271cad2078a80e77fd4c to your computer and use it in GitHub Desktop.
public V remove(K key){
//PRE: key is not null
//POS: the mapping with the key is removed
//TO BE IMPLEMENTED
Element<K,V> target = new Element<K,V>(key, null);
Element<K,V> result = tree.find(target);
if(result != null){
tree.removeElement(result);
return result.getValue();
}else{
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment