Created
April 29, 2020 21:37
-
-
Save lubaochuan/e9f1b2fb77f9271cad2078a80e77fd4c to your computer and use it in GitHub Desktop.
This file contains 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 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