You are viewing a single comment's thread. Return to all comments →
if(root == null) { root = new Node(data); } else if(data < root.data) { root.left = insert(root.left, data); } else { root.right = insert(root.right, data); } return root;
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 →
if(root == null) { root = new Node(data); } else if(data < root.data) { root.left = insert(root.left, data); } else { root.right = insert(root.right, data); } return root;