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);
    }
}

posted on 2012-09-10 10:51  gooner  阅读(121)  评论(0)    收藏  举报