离散数学课件----Trees.ppt

上传人:99****p 文档编号:1585972 上传时间:2019-03-07 格式:PPT 页数:33 大小:1.86MB
下载 相关 举报
离散数学课件----Trees.ppt_第1页
第1页 / 共33页
离散数学课件----Trees.ppt_第2页
第2页 / 共33页
离散数学课件----Trees.ppt_第3页
第3页 / 共33页
离散数学课件----Trees.ppt_第4页
第4页 / 共33页
离散数学课件----Trees.ppt_第5页
第5页 / 共33页
点击查看更多>>
资源描述

1、Trees Lecture 8Discrete Mathematical StructuresRooted Tree Let A be a set, and let T be a relation on A. T is a rooted tree if there is a vertex v0 in A with the property that there exists a unique path in T from v0 to every other vertex in A, but no path from v0 to v0.v0Properties of Rooted Tree Le

2、t (T, v0) be a rooted tree. Then (a) There are no cycles in T. (b) v0 is the only root of T. (c) Each vertex other than the root has in-degree one, and the root has in-degree 0v0vpcMore than one path from v0 to v.(a)v0v0A cycle from v0 to v0(b)v0vkw1 ?More path to w1?(c)Drawing a Rooted Tree by Leve

3、lsRootInner nodeBranching nodeLeafLevel 0Level 1Level 2Level 3Height=3Rooted Tree and Family Relations It is easy to describe the family relations, and on the other hand, terms about family relations are used in rooted trees.JohnJohns childJohns parentJohns ancestorsJohns descendantsJohns siblingsSo

4、me Terms about Rooted Tree Ordered tree: the ordering is assumed on vertices in each level; n-tree: every vertex has at most n offspring; Complete n-tree: every vertes, other than leaves, has exactly n offspring Binary tree: 2-treeSubtree of a Rooted Tree If (T,v0) is a rooted tree and vT. Let T(v)

5、be the set of v and all its descendants, then T(v) and all edges with their two ends in T(v) is a tree, with v as its root.(It is called a subtree of (T,v0) ) Proof: There is a path from v to any other vertex in T(v) since they are all the descendants of v; There cannot be more than one path from v

6、to any other vertex w in T(v) , otherwise, in (T,v0), there are more than one path from v0 to w, both through v There cannot be any cycle in T(v), since any cycle in T(v) is also in (T,v0)Subtrees of Binary Tree In a ordered binary tree, a subtree is a left subtree or a right subtree.Even if a verte

7、x has only one offspring, its subtree canbe identified as left or right by its location in the digraph.Left subtreeRight subtreeLabeled Tree: an Example Using rooted tree to represent a arithmetic expressions: branching vertices corresponding operators leaves corresponding operandsjiagb cde f h/+ +* * *+ -n Example: (a*(b+c)+d*(e*f)/(g+(h-i)*j)Positional Trees222233333111LL LLLLLLRRRRR R RRPositional Binary Tree

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育教学资料库 > 课件讲义

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。