Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private K key;
- private V value;
- Tree<K, V> left;
- Tree<K, V> right;
- private boolean isMax = false;
- public K max() throws EmptyTreeException {
- if(right.toString()!=""){
- return right.max();
- }
- else
- this.isMax = true;
- return this.key;
- }
- public String toString() {
- String result = "";
- result+=(this.left.toString());
- result+=this.key;
- result+="=>";
- result+=this.value;
- if(this.isMax != true){
- result+=" ";
- }
- result+=this.right.toString();
- return result;
- }
Add Comment
Please, Sign In to add comment