C语言实现二叉树的基本功能
本程序实现二叉树的如下功能 1、以先序序列和中序序列构造二叉树 2、以层序序列和中序序列构造二叉树 3、先序遍历、中序遍历、后序遍历、层序遍历 4、求二叉树高度 5、验证这个二叉树是否具备这样的性质:任何一个子树中的结点集合,树根结点的值总是最小。(按字母序) 6、拷贝二叉树 7、将二叉树左右子树交换 8、销毁二叉树 9、删除值为x的节点及其全部子孙 binary_tree.h文件 注:queue.h文件在 这里 # ifndef __BINARY_TREE_H__ # define __BINARY_TREE_H__ # include <stdio.h> # include <stdlib.h> # include <string.h> # include <stdbool.h> # include "queue.h" # define SIZE_bt 1024 struct bt { char data ; struct bt * lchild , * rchild ; } ; struct bt * PreInBuild ( char * pre , char * in ) ; //以先序序列和中序序列构造二叉树 struct bt * LevelInBuild ( char * level , char * in ) ; //以层序序列和中序序列构造二叉树 void