C语言课件-树 Fundamentals of Data Structures in C.ppt

C语言课件-树 Fundamentals of Data Structures in C.ppt

  1. 1、本文档共110页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C语言课件-树 Fundamentals of Data Structures in C

Chapter 5 Trees Outline (1) Introduction (5.1) Binary Trees (5.2) Binary Tree Traversals (5.3) Additional Binary Tree Operations (5.4) Threaded Binary Trees (5.5) Heaps (5.6) (Chapter 9) Binary Search Trees (5.7) Outline (2) Selection Trees (5.8) Forests (5.9) Set Representation (5.10) Counting Binary Trees (5.11) References Exercises 5.1 Introduction What is a “Tree”? For Example : Figure 5.1 (a) An ancestor binary tree Figure 5.1 (b) The ancestry of modern Europe languages The Definition of Tree (1) A tree is a finite set of one or more nodes such that : (1) There is a specially designated node called the root. (2) The remaining nodes are partitioned into n ≥ 0 disjoint sets T1, …, Tn, where each of these sets is a tree. We call T1, …, Tn, the sub-trees of the root. The Definition of Tree (2) The root of this tree is node A. (Fig. 5.2) Definitions: Parent (A) Children (E, F) Siblings (C, D) Root (A) Leaf / Leaves K, L, F, G, M, I, J… The Definition of Tree (3) The degree of a node is the number of sub-trees of the node. The level of a node: Initially letting the root be at level one For all other nodes, the level is the level of the node’s parent plus one. The height or depth of a tree is the maximum level of any node in the tree. Representation of Trees (1) List Representation The root comes first, followed by a list of sub-trees Example: (A(B(E(K,L),F),C(G),D(H(M),I, J))) Representation of Trees (2) Left Child-Right Sibling Representation Fig.5.5 A Degree Two Tree Rotate clockwise by 45° A Binary Tree 5.2 Binary Trees A binary tree is a finite set of nodes that is either empty or consists of a root and two disjoint binary trees called the left sub-tree and the right sub-tree. Abstract Data Type Binary_Tree (structure 5.1) Structure Binary_Tree (abbreviated BinTree) is: Objects: a finite set of nodes either empty or consisting of a root node, left Binary_Tree, and right Binary_Tree. Functions: For all bt, bt1, bt2 ? BinTree, item ? element Bintree Create()

您可能关注的文档

文档评论(0)

jiupshaieuk12 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:6212135231000003

1亿VIP精品文档

相关文档