- 29
- 0
- 约1.33千字
- 约 3页
- 2017-06-07 发布于重庆
- 举报
《数据结构》树的基本操作
实验四
课程名称: 完成日期: 姓名:学号:指导教师: 实验名称: 实验序号: 实验成绩: 一、实验目的及要求
二、实验环境、实验内容
求出它的深度。
、调试过程及实验结果
五、总结、附录(源程序清单)#include
#include
typedef struct CSNode
char data;
struct CSNode *firstchild, *nextsibling;
CSNode, *CSTree;
void createtree CSTree T //以二叉树创建树
char ch;
ch getchar ;
if ch T NULL;
else
if ! T CSNode * malloc sizeof CSNode printf 分配空间出错! ;
T- data ch;
createtree T- firstchild ;
createtree T- nextsibling ; void visit CSTree T //遍历函数,输出结点
if T
printf %c,T- data ;
else
printf 树不存在,输出错误! ; void preroot CSTree T //先根输出
if T
visit T ;
preroot T- firstchild ;
preroot T- n
原创力文档

文档评论(0)