Please explain what’s happening in 2 children node?
Binary search Tress
//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;