4 4
/ \ / \
2 8 insert(6)=> 2 8
/ \ / \
5 10 5 10
\
6
null
, create a new node with the input data and return that node.root.left = insert(root.left, data);
root.right = insert(root.right, data);
root
.
public TreeNode insert(TreeNode root, int data) { }
C
Java
Python