Binary search Tress

Please explain what’s happening in 2 children node?

Hey @vanshikasharma1645

//Two child case
               Treenode*replace =root->right; //right subtree of the node to be deleted 
               while(replace->left!=NULL){  //finding the smallest element in right subtree
                   replace=replace->left;

               }
               root->data=replace->data;  //replacing smallest node data by node to be deleted
               root->right=deletionfrombst(root->right,replace->data); //delete smallest data node in Right subtree
               return root;