1. Engineering
  2. Computer Science
  3. how do i change this into one single public class...

Question: how do i change this into one single public class...

Question details

How do I change this into one single public class?

public void insert(int data)
{
root = insert(root, data);
}

private Node insert(Node node, int data)
{
if (node == null)
node = new Node(data);
else
{
if(node.getData()<data){
node.setRight(insert(node.getRight(), data));
}
else{
node.setLeft(insert(node.getLeft(), data));
}   
}
return node;
}   

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution