Untitled

mail@pastecode.io avatarunknown
plain_text
2 months ago
318 B
0
Indexable
Never
TreeNode<int>* insertionInBST(TreeNode<int>* root, int val)
{
    if(root==NULL){
        TreeNode<int>* tmp=new TreeNode<int>(val);
        return tmp;
    }
    if(val<root->val) root->left=insertionInBST(root->left,val);
    if(val>root->val) root->right=insertionInBST(root->right,val);
    return root;
}