Untitled
unknown
plain_text
3 years ago
404 B
9
Indexable
TBTnode * pre_succ(TBTnode *P)
{
 if(p->lbit==1) //normal left child
 return(p->left);
 while(p->rbit==0)//climb up till right node is a 
link
 p=p->right;
 return(p->right);
 }
void Tpreorder(TBTnode *T)
 {
 TBTnode *head;
 head=T; //dummy
 T=T->left; //root
 while(T!=head) //preorder starts with root
 {
 printf(“%d”,T->data);
 T=pre_succ(T); //preorder successor
 }
}Editor is loading...