You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, there is a problem in the code of Binary tree insertion . I think there is a missing return statement in the if(root==NULL) part.
Correct would be
node * insert(node * root, int value)
{
node * newNode = new node();
newNode->data = value;
newNode->left = NULL;
newNode->right = NULL;
if(root == NULL){
root = newNode;
return root; //correction part
Hey, there is a problem in the code of Binary tree insertion . I think there is a missing return statement in the if(root==NULL) part.
Correct would be
node * insert(node * root, int value)
{
node * newNode = new node();
newNode->data = value;
newNode->left = NULL;
newNode->right = NULL;
if(root == NULL){
root = newNode;
return root; //correction part
}
The text was updated successfully, but these errors were encountered: