1. Question
2. Code
Node* BST :: deletemin(Node*& r){
if(r == NULL){
return NULL;
}
if(r->lc == NULL){
if(r->rc != NULL){
if(r->father != NULL){
r->rc->father = r->father;
r->father->lc = r->rc;
return r;
}
else{
cout << ":r->rc = " << r->rc << endl;
cout << ":root = " << root << endl;
this->root = r->rc;
cout << "r->rc = " << r->rc << endl;
cout << "root = " << root << endl;
cout << "r->rc->father" << r->rc->father << endl;
cout << "root->father" << r->father << endl;
root->father = NULL;
return r;
}
}
else{
Node* temp = r;
r = NULL;
return temp;
}
}
return deletemin(r->lc);
}
3. Error
After ther-> rc pointer is assigned to root, the value of the r-> rc pointer changes automatically, even though I didn"t do anything
4. Screenshot
5. Attempted to resolve
I have searched all over the network, and there is no similar situation. I hope God will let me know. I would appreciate it!
6. The tail
code has been transferred, and partners who need reference can download the research
link:
extraction code: v4bz