So I already have this Insert function for a Value in my Tree how can I convert it to this type of void function?
void InsertValue(Node* root, int value){
this is my normal function:
Node* Insert(Node* root,int value) {
if(root == NULL) { // empty tree
root = CreateNode(value);
}
// if data to be inserted is lesser, insert in left subtree.
else if(value <= root->value) {
root->left = Insert(root->left,value);
}
// else, insert in right subtree.
else {
root->right = Insert(root->right,value);
}
return root;
}
Thanks for your help