You are viewing a single comment's thread. Return to all comments →
Luckily I completed in 20 lines
Node current=root; Node last=root; while(current!=null){ last=current; if(current.data<value)current=current.right; else current=current.left; } Node temp=new Node(); temp.data=value; if(root==null)return temp; if(last.data<value)last.right=temp; else last.left=temp; 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 →
Luckily I completed in 20 lines