削除機能が動作しません。ノードを削除すると、残っているのはノードのサブツリーです。
これの何が悪いと思いますか?前もって感謝します。
node *deleteNode(node* &root, node *z){
node *x, *y;
cout << "Element to delete: " << z->data << endl;
if (z->leftchild == nil || z->rightchild == nil)
y = z;
else
y = treesuccessor(z);
if (y->leftchild != nil)
x = y->leftchild;
else
x = y->rightchild;
if (x != nil)
x->parent = y->parent;
if (y->parent == nil)
root = x;
else if (y == y->parent->leftchild)
y->parent->leftchild = x;
else
y->parent->rightchild = x;
if (y != z)
z->data = y->data;
if (y->color == black)
deletefixup(root, x);
return y;
}