I have to edit MyTree class and implement remove, printReverse and display method. I have included t

I have to edit MyTree class and implement remove, printReverse and display method. I have included the provided code below.*Implement remove and printReverse method*Implement display method to display the tree structure public class MyTree{ private TreeNode root;

public MyTree(){



public void remove(int data){

//implement this method to remove a node with the same datavalue


public void printReverse(){

//implement this method to print data in descending order


public void display(){

//implement to display the tree structure


public boolean isEmpty(){ return root==null;}

public int size(){

return sizeHelper(root);


private int sizeHelper(TreeNode node){

if(node==null) return 0;

else return1+sizeHelper(node.getLeft())+sizeHelper(node.getRight());


public boolean search(int data){

return searchHelper(root, data);


private boolean searchHelper(TreeNode node, int data){

if(node==null) return false;

if(node.getData()==data) return true;

else if(node.getData()return searchHelper(node.getRight(),data);


return searchHelper(node.getLeft(), data);


public void add(int data){

root=addHelper(root, data);


private TreeNode addHelper(TreeNode node, int data){

if(node==null) node=new TreeNode(data);

else if(data

node.setLeft(addHelper(node.getLeft(), data));


node.setRight(addHelper(node.getRight(), data));

return node;


public void printInorder(){



private void printHelper(TreeNode node){







} given : TreeNode.java public class TreeNode implements Comparable{ private int data;

private TreeNode left;

private TreeNode right; public TreeNode(int data){



} public int getData(){

return data;


public TreeNode getLeft(){

return left;


public TreeNode getRight(){

return right;


public void setData(int data){

this.data = data;


public void setLeft(TreeNode left){

this.left = left;


public void setRight(TreeNode right){

this.right = right;


public int compareTo(TreeNode node){

return data-node.getData();


} . . .

Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.