You are viewing a single comment's thread. Return to all comments →
Mostly similar Java solution:
static Node Insert(Node root,int value) { Node insert = new Node(); insert.data = value; if(root == null) { return insert; } Node current = null; Node next = root; while(next != null) { current = next; next = (current.data < value) ? current.right : current.left; } if(current.data < value) { current.right = insert; } else { current.left = insert; } 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 →
Mostly similar Java solution: