2019离散数学课件-无向树.ppt
- 格式:ppt
- 大小:1.04 MB
- 文档页数:29
第7章树trees分类§7.1 树定义1:T是集合A上一个二元关系,T称为树tree,如果存在v0∈A,任意v∈A,v≠v0,到v0都有唯一一条路径,(v0, v0) T. T叫做根树,记做(T,v0)。
A中元素称为T的顶点vertex,T中元素称为边,v0称为根root。
定理1. 设(T,v0)是树,则(a)T中没有回路。
(b)只有一个根v0。
(c)任意v∈A,v≠v0,v有入度1,v0入度是0。
证明:定义2层次levelv0的层次为0,v0的子女offspring层次为1,v0是子女的父母parent。
v i的层次为k,v i的子女offspring层次为k +1,v i是子女的父母parent,T的最大层次称为高度height。
无子女的顶点叫叶leaf。
v i的子女叫同胞sibling,同胞如有长幼,从左到右,老大,老二,老三等,组成线性序,T称为有序树,ordered tree定理2. 设(T,v0)是根树,则(a)T反自反。
(b)T反对称。
(c)(a,b)∈T,(b,c)∈T ⇒ (a,c)∉T。
定义3:n-树:每个顶点至多n个子女。
二叉树:2-树。
完全n-树:每个非叶顶点恰有n个子女。
定义4A rooted binary tree is a rooted tree in which every node has at most two children.A full binary tree (sometimes proper binary tree or 2-tree) is a tree in whichevery node other than the leaves has two children.A perfect binary tree is a full binary tree in which all leaves are at the same depth or same level.[1] (This is ambiguously also called a complete binary tree.)A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.[2]An infinite complete binary tree is a tree with levels, where for each level d thenumber of existing nodes at level d is equal to 2d. The cardinal number of the set of all nodes is . The cardinal number of the setof all paths is .A balanced binary tree is a tree where the depth of all the sub-trees differs by at most 1.定理3. 设(T,v0)是根树,v∈T,则T(v)是T的子树,T(v)的根是v。