题目描述
Description
完成二叉排序树复制功能。我们经常对文件或文件夹进行复制和粘贴操作,在这里我们完全复制一棵二叉树。首先创建一棵具有若干结点的二叉排序树Ta,对其进行前、中、后序遍历并输出。复制生成Tb,对其进行前、中、后序遍历,再分别对两个树插入若干数据后遍历。
#include “stdio.h”
#include “malloc.h”
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
#define OVERFLOW -2
typedef int Status;
typedef int ElemType;
typedef struct BiTNode{
ElemType data;
struct BiTNode *lchild,*rchild;//左右孩子指针
} BiTNode,*BiTree;
Status InsertBiTree(BiTree &T,int e) //插入新结点
{
if(T==NULL){
T=(BiTNode *)malloc(sizeof(BiTNode));
T->data=e;T->lchild=NULL;
T->rchild