BiThrTree IPrePostNode(BiThrTree head,BiThrTree p) |
{ /*在中序线索二叉树上寻找结点p 的先序的后继结点,head 为线索树的头结点*/ |
BiThrTree post; |
if ( p->ltag==0 ) post=p->lchild; |
else |
{ |
post=p; |
while ( post->rtag==1&&post->rchild!=head ) post=post->rchild; |
post=post->rchild; |
} |
return ( post ); |
} |