You are viewing a single comment's thread. Return to all comments →
public static Node insert(Node root,int data) { root = addRecursive(root, data); return root; } public static Node addRecursive(Node current, int data) { if(current == null) return new Node(data); else { if(current.data < data) { current.right = addRecursive(current.right, data); } if(current.data > data) { current.left = addRecursive(current.left, data); } } return current; }
Seems like cookies are disabled on this browser, please enable them to open this website
Binary Search Tree : Insertion
You are viewing a single comment's thread. Return to all comments →