Untitled

Anonymous
plain_text
08/07/2023 12:21 PM
424 B
21
Indexable
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;
}
Editor is loading...