Beispiel #1
0
Datei: tree1.c Projekt: beatyou/C
/*后序遍历*/
void last_tree(node *root)
{
	if(root!=NULL)
	{
		last_tree(root->lchild);
		last_tree(root->rchild);
		printf("%c\t",root->ch);
	}
}
Beispiel #2
0
void last_tree(struct tree *root)
{
    if (root->lc != NULL) {
        last_tree(root->lc);
    }   
    if (root->rc != NULL) {
        last_tree(root->rc);
    }   
    printf("%c ", root->data);
}
Beispiel #3
0
void last_tree(struct tree *phead)
{
    if (phead->lc != NULL) {
        last_tree(phead->lc);
    }
    if (phead->rc != NULL) {
        last_tree(phead->rc);
    }
    printf("%d ", phead->data);
}
Beispiel #4
0
Datei: tree1.c Projekt: beatyou/C
int main(int argc, char const *argv[])
{
	node *root=init_tree();
	pre_tree(root);
	printf("\n");
	mid_tree(root);
	printf("\n");
	last_tree(root);
	printf("\n");
	return 0;
}
Beispiel #5
0
void show_tree(struct tree *root)
{
    printf("this is first tree:\n");
    first_tree(root);
    printf("\n");
    printf("this is middle tree:\n");
    middle_tree(root);
    printf("\n");
    printf("this is last tree:\n");
    last_tree(root);
    printf("\n");
}
Beispiel #6
0
void show_tree(struct tree *phead)
{
    printf("this is first tree:\n");
    first_tree(phead);
    printf("\n");
    printf("this is middle tree:\n");
    middle_tree(phead);
    printf("\n");
    printf("this is last tree:\n");
    last_tree(phead);
    printf("\n");
}