在一个二叉排序树(BST)(left<right)中查找某个节点的后序节点
//节点结构
struct NODE
{
int data;
NODE* left;
NODE* right;
}
//查找方法
NODE* FindNext(NODE* pRoot,NODE* theNode)
{
NODE* pNode = pRoot;
NODE* pNext = NULL;
while(pNode)
{
if(pNode->data > theNode->data)
{
pNext = pNode;
pNode = pNode->lchild;
}
else
{
pNode = pNode->rchild;
}
}
return pNext;
}