这应该是遍历一个BST并删除每个节点,包括根节点。然而,最后,我得到了“root还有一个左节点”的消息。为什么并非所有节点都被删除? void deleteTree()
{
deleteNode(root);
if(root->right)
cout << "root still has a right node" << endl;
if(root->l
if right[x] != NIL
then return TREE-MINIMUM(right[x])
y<-p[x]
while y!= NIL and x = right[y]
do x<-y
y<-p[y]
return y
我知道什么是“正确的,如果[X] = NIL然后返回树民!”的意思,我已经将它翻译成: if(p->RChild) return