1、基本概念
(1)递归定义
(2)术语
...这些从略了
2、表示
比较流行的表示法叫做Firstchild-Nextsibling:
struct Tree{
DataType Data;
TreePtr FirstChild;
TreePtr NextSibling;
};
3、二叉树
(1)基本性质(其实很多是树的性质)
①除了叶子之外的所有点叫做“内点”,也就是入度为1,出度不为0的点,或者说,也就是有孩子的顶点。假如一棵满m叉树的内点是i,则它一共有mi+1个顶点
②高度为h的m叉树最多有m^h个叶子
注:单个节点的树高在一些书上是1,一些是0,个人觉得。。
③For any nonempty binary tree, n0 = n2 + 1, where n0 is the number of leaf nodes and n2 the number of nodes of degree 2.
(2)重要的问题
①前序遍历(递归和非递归)
②中序遍历(递归和非递归)