/** * Definition of TreeNode: * public class TreeNode { * public int val; * public TreeNode left, right; * public TreeNode(int val) { * this.val = val; * this.left = this.right = null; * } * } */publicclassSolution {/* * @param root: The root of the binary search tree. * @param node: insert this node into the binary search tree * @return: The root of the new binary search tree. */publicTreeNodeinsertNode(TreeNode root,TreeNode node) {if (root ==null)return node;if (node.val<root.val) {root.left=insertNode(root.left, node); } else {root.right=insertNode(root.right, node); }return root; }}