I need some help to why an insertion in a bst doesn't work on the following code. Is there some concept on how java passes parameters that I do not know?
public void insert(int input){
insert(root, input);
}
private void insert(Node node, int input){
Node new_node = new Node(input);
if (node == null) {
node = new_node;
}
else if (input == node.data) {
System.out.println("input exists");
}
else {
if (input < node.data) {
insert(node.left, input);
}
else{
insert(node.right, input);
}
}
}