数据结构树完整程序(一定能运行).docVIP

  • 13
  • 0
  • 约1.24万字
  • 约 18页
  • 2017-10-27 发布于重庆
  • 举报
数据结构树完整程序(一定能运行)

二叉树顺序结构实现 ? #include stdio.h???? #include stdlib.h??? #include io.h?? #include math.h?? #include time.h #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 #define MAXSIZE 100 /* 存储空间初始分配量 */ #define MAX_TREE_SIZE 100 /* 二叉树的最大结点数 */ typedef int Status;??/* Status是函数的类型,其值是函数结果状态代码,如OK等 */ typedef int TElemType;? /* 树结点的数据类型,目前暂定为整型 */ typedef TElemType SqBiTree[MAX_TREE_SIZE]; /* 0号单元存储根结点? */ typedef struct { ?int level,order; /* 结点的层,本层序号(按满二叉树计算) */ }Position; TElemType Nil=0; /*? 设整型以0为空 */ Status visit(TElemType c) { ?printf(%d ,c); ?return OK; } /* 构造空二叉树T。因为T是固定数组,不会改变,故不需要 */

文档评论(0)

1亿VIP精品文档

相关文档