You are viewing a single comment's thread. Return to all comments →
you can skip null part, just node.data will do
static Node Insert(Node root,int value) { if(root == null){ Node node = new Node(); node.data = value; root = node; } else{ if(value < root.data){ root.left = Insert(root.left, value); } else if(value > root.data) root.right = Insert(root.right, value); } 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 →
you can skip null part, just node.data will do