
int InOrderThr ( BiThrTree *head,BiThrTree T )
{/*中序遍历二叉树T,并将其中序线索化,*head 指向头结点。*/
if ( ! ( *head = ( BiThrNodeType* ) malloc ( sizeof ( BiThrNodeType ) ) ) ) return 0;
( *head )->ltag=0;
( *head )->rtag=1; /*建立头结点*/
( *head )->rchild=*head; /*右指针回指*/
if ( !T ) ( *head )->lchild =*head; /*若二叉树为空,则左指针回指*/
else
{
( *head )->lchild=T;
pre= head;
InThreading ( T ); /*中序遍历进行中序线索化*/
pre->rchild=*head;
pre->rtag=1; /*最后一个结点线索化*/
( *head )->rchild=pre;
}
return 1;
}



