Question: Java Language. Code given public class MyTree{ private TreeNode root; public MyTree(){ root=null; } public boolean isEmpty(){ //implement this method } public int size(){ //implement

Java Language.
Code given
public class MyTree{
private TreeNode root;
public MyTree(){
root=null;
}
public boolean isEmpty(){ //implement this method
}
public int size(){ //implement this method to return the number of nodes in the tree
return 0;
}
public void add(int data){ //implement this method to add the data to the tree
}
public void display(){ //implement this method to display the tree structure
}
public TeeeNode maxNode(){//implement this method to return the node which has the maximum value
}
public void inOrder(){ //visit left subtree, root, then right subtree
}
public void preOrder(){ //visit root, left subtree, then right subtree
}
public void postOrder(){// visit left subtree, right subtree, then root
}
public void printReverse(){ //implement this method to print the data in descending order
}
}
 Java Language. Code given public class MyTree{ private TreeNode root; public

1. Create a java file named MyTree.java 2. Copy the entire code in the MyTree.txt and paste to your MyTree.java 3. Implement the required methods 4. Once completed, use the TreeDriver.class to test your implementations. If you impiement all methods properly, the output should look like: TreeDriver.class: Results 20 368920 209863 9 63 820 3 8 6 20 9 reverse postOrdor DELL

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!