Delete Nodes From A BST : Run errors

Please look into the code as I am facing run errors in my code.
I got the correct answer for 2 test cases.

You have sent me the whole BST code I cant find the reqd function. So I am providing you with my code. you can compare with it

void deleteKey(int key)
{
root = deleteRec(root, key);
}
/* A recursive function to insert a new key in BST /
Node deleteRec(Node root, int key)
{
/
Base Case: If the tree is empty /
if (root == null) return root;
/
Otherwise, recur down the tree */
if (key < root.key)
root.left = deleteRec(root.left, key);
else if (key > root.key)
root.right = deleteRec(root.right, key);
// if key is same as root’s key, then This is the node
// to be deleted
else
{
// node with only one child or no child
if (root.left == null)
return root.right;
else if (root.right == null)
return root.left;
// node with two children: Get the inorder successor (smallest
// in the right subtree)
root.key = minValue(root.right);
// Delete the inorder successor
root.right = deleteRec(root.right, root.key);
}
return root;
}

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.