摘要: 使用递归方式创建二叉树,然后备份原来的二叉树,最后将原来的二叉树和备份的二叉树都输出来 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 struct tree 5 { 6 int data; 7 struct tree* left; 8 struct t 阅读全文
posted @ 2021-01-01 18:40 互联星空 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 二叉树的递归创建 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 struct tree 5 { 6 int data; 7 struct tree* left; 8 struct tree* right; 9 }; 10 11 typedef stru 阅读全文
posted @ 2021-01-01 15:57 互联星空 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 中序遍历 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 struct tree 5 { 6 int data; 7 struct tree* left; 8 struct tree* right; 9 }; 10 11 typedef struct t 阅读全文
posted @ 2021-01-01 15:25 互联星空 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 二叉树的数组表示 1 #include <stdio.h> 2 3 void createbtree(int * btree,int *data,int len) 4 { 5 int level; 6 int i; 7 8 btree[1] = data[1]; 9 for(i = 2; i <= 阅读全文
posted @ 2021-01-01 14:51 互联星空 阅读(657) 评论(0) 推荐(0) 编辑