填空题
[说明]
完成以下中序线索化二叉树的算法。
[函数]
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
提交答案
关闭