首页 > 其他 > 详细

树的存储

时间:2014-11-29 08:59:39      阅读:174      评论:0      收藏:0      [点我收藏+]

树的存储方式

//树的双亲表示
typedef struct{  //节点结构
 ElemType data;  //元素
 int parent;     //双亲位置
}PTNode;
typedef struct{  //树
 PTNode nodes[Max];
 int n;        //树的节点个数
}PTree;

//孩子表示法
typedef struct{ //孩子结点
 int child;     //孩子位置
 struct CNode* next;
}CNode;      
typedef struct{
 ElemType data;
 CNode *next;     //指向第一个孩子的指针
}PNode,PTree[Max];


//孩子兄弟表示法
typedef struct CSNode{
 ElemType data;
 struct CSNode *firstchilde,*nextsibling;
}CSNode,*CSTree;


树的存储

原文:http://blog.csdn.net/fyxz1314/article/details/41592899

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!