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

Stuck with a difficult assignment? No time to get your paper done? Feeling confused? If you’re looking for reliable and timely help for assignments, you’ve come to the right place. We promise 100% original, plagiarism-free papers custom-written for you. Yes, we write every assignment from scratch and it’s solely custom-made for you.


Order a Similar Paper Order a Different Paper

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(){

root=null;

}

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);

else

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));

else

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

return node;

}

public void printInorder(){

printHelper(root);

}

private void printHelper(TreeNode node){

if(node!=null){

printHelper(node.getLeft());

System.out.println(node.getData());

printHelper(node.getRight());

}

}

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

private TreeNode left;

private TreeNode right; public TreeNode(int data){

this.data=data;

left=right=null;

} 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();

}

} . . .

Writerbay.net

We’ve proficient writers who can handle both short and long papers, be they academic or non-academic papers, on topics ranging from soup to nuts (both literally and as the saying goes, if you know what we mean). We know how much you care about your grades and academic success. That's why we ensure the highest quality for your assignment. We're ready to help you even in the most critical situation. We're the perfect solution for all your writing needs.

Get a 15% discount on your order using the following coupon code SAVE15


Order a Similar Paper Order a Different Paper