数据结构-tree
Data Structure Software College Northeastern University Chapter 6 Tree Overview What is Tree Tree Terminology Tree ADT Binary Trees Binary Tree ADT Storing Binary Trees Binary Tree Traversals Applications of Binary Tree Storing Trees Tree Traversals Huffman Code Tree Nature View of a Tree Computer Scientist’s View What is a Tree A tree is a finite nonempty set of elements. It is an abstract model of a hierarchical structure. consists of nodes with a parent-child relation. Applications: Organization charts File systems Programming environments What is a Tree:Examples What is a Tree:Examples Tree Terminology Root: node without parent (A) Siblings(兄弟): nodes share the same parent Internal node(内部结点): node with at least one child (A, B, C, F) External node (leaf ): node without children (E, I, J, K, G, H, D) Ancestors (祖先)of a node: parent, grandparent, grand-grandparent, etc. Descendant(后裔) of a node: child, grandchild, grand-grandchild, etc. Tree Terminology Depth of a node: number of ancestors Height of a tree: maximum depth of any node Degree of a node: the number of its children Degree of a tree: the maximum number of its node. Subtree: tree consisting of a node and its descendants Tree Properties Tree ADT We use positions to abstract nodes Generic methods: integer size() boolean isEmpty() objectIterator elements() positionIterator positions() Accessor methods: position root() position parent(p) positionIterator children(p) Binary Tree A binary tree is a tree with the following properties: Each internal node has at most two children (degree of two) The children of a node are an ordered pair Binary Tree We call the children of an internal node left child and right child Alternative recursive definition: a binary tree is either a tree consisting of a single node, OR a tree whose root has an ordered pair of children, each of which is a binary tree Applications: arithmetic expressions decision processes searching Arithmetic Expression Tree Binary
您可能关注的文档
- 急性心肌梗死诊疗.ppt
- 思想品德课开卷考试的答题技巧.ppt
- 怎样销售软件?软件业务员的.ppt
- 思修第八章(法律制度).ppt
- 情境4开标、评标和中标.ppt
- 必修二:经济模块第1课.ppt
- 思想道德修养与法律基础第八章2、民法.ppt
- 情境5章合同法律制度.ppt
- 必修二专题一1.古代中国的农业经济.ppt
- 思想道德修养与法律基础第8章1.ppt
- 03-2 2025年度民主生活会征求意见座谈会主持词.docx
- 03-1 2025年度民主生活会主持讲话提纲.docx
- 02-1 会前学习-《县以上党和国家机关党员领导干部民主生活会若干规定》相关要求.docx
- 在2025年度民主生活会上的总结讲话三篇.docx
- 在2025年度民主生活会上的总结讲话三篇 (3).docx
- 市委宣传部2025年度民主生活会查摆问题整改方案两篇.docx
- 在市行政审批和政务信息管理局机关2026年全体干部政绩观教育大会上的党课讲稿.docx
- X市应急管理局2026年度安全生产监督检查计划.docx
- 2025年度民主生活会领导班子对照检查材料(五个带头)三篇.docx
- 2025年度民主生活会“五个带头”个人对照检查材料三篇.docx
最近下载
- 金航联执业药师继续教育《氯吡格雷临床使用药学解读》习题答案.docx VIP
- 如何进行神话故事的阅读教学——从盗取天火的“普罗米修斯”说起-来源:小学教学参考(上旬)(第2020003期)-广西教育学院.pdf VIP
- 道路危险货物运输从业人员从业资格考试大纲培训教学大纲和培训教学计划.docx VIP
- 道路危险货物运输从业人员从业资格考试大纲、培训教学大纲和培训教学计划.doc VIP
- 蜜雪冰城店加盟合同范本.docx VIP
- 老年人多重用药评估与管理中国专家共识(2024)解读PPT课件.pptx VIP
- 城市立体化社会治安防控体系建设工作方案.docx VIP
- 老年人多重用药评估与管理中国专家共识(2024)解读PPT课件.pptx VIP
- 2024年天津市成人高考专升本高等语文真题及答案.docx VIP
- 道路工程监理实施细则.docx
原创力文档

文档评论(0)