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