非二叉树转二叉树的表示法
2016-05-01 11:15
323 查看
//树的存储结构,详细图解分析在 秦玉平 马靖善所编的数据结构(第三版) p137-142*/ #include<stdio.h> #define MAX 100 typedef char Elemtype; //双亲表示法 typedef struct{ Elemtype node; int father; }PTNode; typedef struct{ PTNode nodes[MAX]; int n; }PTree; //孩子双亲表示法,若需要孩子链表表示法,则删除CTBox中的parent就行 typedef struct Node { int child; struct Node *next; }CTnode,*ChildPtr; typedef struct{ Elemtype data; ChildPtr FirstChild; int parent; }CTBox; typedef struct{ CTBox nodes[MAX]; int n; }CTtree; //以上三种结构都是用顺序表形式表示树和森林,这很难转换成二叉树的存储形式,也就不能用二叉树中的理论和结构来描述树和森林 //孩子兄弟表示法,这种方法可以把树转变为二叉树 typedef struct CSNode{ Elemtype data; struct CSNode *firstnode,*nextsibling; }CSNode,*CSTree;
相关文章推荐
- java之StringBuffer的一些用法
- Problem O
- HDU 5756 ztr loves lucky numbers dfs
- Android学习系列一用按钮实现显示时间
- android多进程实验
- leetcode-107. Binary Tree Level Order Traversal II
- 计算机基础-Socket详解
- 如何上传应用到 Google Play
- 剑指offer(62):之字形打印二叉树
- Swift3.0为视图添加旋转动画_CABasicAnimation
- 类的内存空间大小
- POJ3278解题报告
- 布尔代数
- 链表结点的删除
- MySql的使用简介
- Visual Studio 统计代码行数
- sublime常用的插件
- 深入分析_linux_spinlock_实现机制
- uva 5734 Shape Number
- VISUAL SVN安装 及客户端使用