各路英雄好汉请注意!哪位高手会用C语言编写树的建立和遍历?

来源:百度知道 编辑:UC知道 时间:2024/06/05 07:36:58
数据结构老师在课堂上讲了树的建立和遍历的算法,回头让我自己用C语言编写它们的程序 ,可谓绞尽脑汁,但总运行不了.

#include <iostream>
#include <string>
#include <stdio.h>
#include <cstdio>
#include <stdlib.h>
using namespace std;
///////////////////////////////////////////////////////////////////////////////////////////
#define MAXSIZE 20
///////////////////////////////////////////////////////////////////////////////////////////
typedef struct BiTree //二叉树结构体定义
{
char date; //节点值
struct BiTree *lchild; //左字树指针
struct BiTree *rchild; //右字树指针
}BitNode,*BitTree;
///////////////////////////////////////////////////////////////////////////////////////////
typedef struct
{
BitTree data[MAXSIZE]; //堆栈结构体定义
int top; //存储二叉树的指针
}SeqStack;
///////////////////////////////////////////////////////////////////////