大话数据结构——树的存储结构
2015-03-19 15:14
162 查看
#include<iostream> using namespace std; //树的存储结构 #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define MAX 1000 typedef int elemtype;//数据类型 /*双亲表示法的存储结构*/ //根节点的结构 typedef struct PtNode { elemtype data;//节点的数据 int parent;//节点双亲的位置 }PtNode; //树的结构 typedef struct tree { PtNode nodes[MAX];//节点数组 int r,n;//根节点的位置,节点数 }tree; /*孩子表示法*/ //孩子结点 typedef struct CTNode { int child; struct CTNode * next; }CTNode; //表头结构 typedef struct CTbox { elemtype data; CTNode *firstchild; }CTbox; //树结构 typedef struct CTtree { CTbox tree[MAX];//结点数组 int r,n;//根节点位置,节点数 }CTtree; /*孩子兄弟表示法*/ typedef struct BRNode { elemtype data;//结点数据 BRNode *firstchild,*rightchild;//指针域,分别指向第一个孩子和右兄弟。 }BRNode; int main() { }
相关文章推荐
- 大话数据结构二十:图的存储结构之十字链表
- 大话数据结构二十一:图的存储结构之邻接多重表
- 大话数据结构二十二:图的存储结构之边集数组
- 数据结构之线性表代码实现顺序存储,链式存储,静态链表(选自大话数据结构)
- 读书笔记-《大话数据结构》第三章 线性表之链式存储结构
- Cassandra的数据存储结构——cassandra总结(一)
- SQL Server 存储(8/8):理解数据文件结构
- delphi利用指针,结构或component存储数据表数据
- 采用左右值编码来存储无限分级树形结构的数据库表设计
- 树的三种存储结构
- 数据结构笔记:线性表链式存储结构
- 数据结构之线性表顺序存储的常用操作(转载)
- ios-day12-01(ios开发中的数据存储的常用方式有哪些、应用沙盒目录结构、应用沙盒目录路径的常见获取方式)
- C++存储数据结构之一List
- Oracle存储结构_文件
- 存储——硬盘结构
- 树的存储结构-双亲表示法-代码
- 数据结构中链式存储的注意点(线性与栈)
- 4种存储结构
- Android软件开发之获取通讯录联系人信息 + android联系人信息的存储结构 + Android联系人读取操作笔记