填空题 [说明]
完成以下中序线索化二叉树的算法。
[函数]
Typedef int datatype;
Typedef struct node {
Int ltag, rtag;
Datatype data;
*lchild,* rchild;
}bithptr;
bithptr pre;
void inthread ( p );
{if
{inthread ( p->lchild );
if ( p->lchild==unll ) __ 1__ ;
if ( P->RCHILD=NULL) p->rtag=1;
if __ 2__
{if __ 3__ pre->rchild=p;
if ( p->1tag==1 ) __ 4__ ;
}
INTHREAD ( P->RCHILD );
__ 5__ ;
}
}
【正确答案】
【答案解析】P->LTAG=0 (PRE)
(PRE->RTAG==1) P->LCHILD=PRE PRE=P