是不是有错
????
后来改了,前面的是有错,没考虑周全
Node *Node::searchNode(int nodeIndex)
{
Node *temp=NULL;
if(this->index==nodeIndex) return this;
if(this->pLChild!=NULL)
{
if(this->pLChild->index==nodeIndex)
return this->pLChild;
else
{
temp=this->pLChild->searchNode(nodeIndex);
if(temp!=NULL) return temp;
}
}
if(this->pRChild!=NULL)
{
if(this->pRChild->index==nodeIndex)
return this->pRChild;
else
{
temp=this->pRChild->searchNode(nodeIndex);
if(temp!=NULL) return temp;
}
}
return NULL;
}