You are viewing a single comment's thread. Return to all comments →
node * insert(node * root, int value) { if(root == NULL) { node* node; node->data = value; node->left = NULL; node->right =NULL; root = node; } else if(value>root->data) { root->right = insert(root->right,value); } else if(valuedata) { root->left = insert(root->left,value); }
return root; }
What am i doing wrong here? it keeps failing.
Binary Search Tree : Insertion
You are viewing a single comment's thread. Return to all comments →
node * insert(node * root, int value) { if(root == NULL) { node* node; node->data = value; node->left = NULL; node->right =NULL; root = node; } else if(value>root->data) { root->right = insert(root->right,value); } else if(valuedata) { root->left = insert(root->left,value); }
return root; }
What am i doing wrong here? it keeps failing.