1、DLR
void perorder(PTree _root)
{
if(NULL !=root)
{
printf("%d ",root->data);// data is integer
perorder(root->lchild);
perorder(root->rchild);
}
}
2、LDR
void inorder(Tree* root)
{
if(NULL !=root)
{
inorder(root->lchild);
printf("%d ",root->data);
inorder(root->rchild);
}
}
3、LRD
void postorder(Tree* root)
{
if(NULL !=root)
{
postorder(root->lchild);
postorder(root->rchild);
printf("%d ",root->data);
}
}
浙公网安备 33010602011771号