- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
AVL Trees.ppt
AVL Trees CSE, POSTECH Balanced Binary Search Trees If the height of a binary tree is always O(log n), we can guarantee O(log n) performance for each search tree operation Trees with a worst-case height of O(log n) are called balanced trees An example of a balanced tree is AVL (Adelson-Velsky and Landis) tree AVL Tree Definition Binary tree. If T is a nonempty binary tree with TL and TR as its left and right subtrees, then T is an AVL tree iff TL and TR are AVL trees, and |hL – hR| ? 1 where hL and hR are the heights of TL and TR, respectively AVL Search Trees An AVL search tree is a binary search tree that is also an AVL tree Which trees in Figure 14.1 are AVL trees? (a) and (b) Which trees in Figure 14.1 are AVL search trees? (b) only Which trees in Figure 14.3 are AVL search trees? (a) and (b) Indexed AVL Search Trees An indexed AVL search tree is an indexed binary search tree that is also an AVL tree Which trees in Figure 14.2 are indexed AVL trees? (a) and (b) Which trees in Figure 14.2 are indexed AVL search trees? (a) and (b) Properties of AVL Tree The height of an AVL tree with n nodes is O(log n) For every value of n, n ? 0, there exists an AVL tree An n-node AVL search tree can be searched in O(height) = O(log n) time A new node can be inserted into an n-node AVL search tree so that the result is an n+1 node AVL tree and insertion can be done in O(log n) time A node can be deleted from an n-node AVL search tree, n0, so that the result is an n-1 node AVL tree and deletion can be done in O(log n) time Balance Factor AVL trees are normally represented using the linked representation To facilitate insertion and deletion, a balance factor (bf) is associated with each node The balance factor bf(x) of a node x is defined as height(x?leftChild) – height(x?rightChild) Balance factor of each node in an AVL tree must be –1, 0, or 1 See Figure 15.1 for examples AVL Tree with Balance Factors Is this an AVL tree? What is the balance factor for each node in this A
您可能关注的文档
- 21世纪什么最重要? .ppt
- 4 bit Versatile CMOS Rate Multiplier.ppt
- 4.4 Modeling and Optimization.ppt
- 40 and 100 GbE –Network Interfaces of the Future.ppt
- 40 Gbs and 100 GbsTechnologies forResearch & Education.ppt
- 4MB Clinical Problem-Solving.ppt
- 7.5 线索二叉树.ppt
- 8.1. Non-contrast CT Brain.ppt
- 9 Intangibles.ppt
- 9. AJAX & RIA.ppt
- 2026年消防设施操作员之消防设备基础知识考试题库500道带答案(新).docx
- 销售岗前培训课件.ppt
- 2026年消防设备操作员考试题库500道(典型题).docx
- 2026年消防设施操作员之消防设备高级技能考试题库300道附答案(实用).docx
- 2026年消防设施操作员之消防设备高级技能考试题库300道标准卷.docx
- 2026年材料员之材料员基础知识考试题库300道附完整答案(全优).docx
- 2026年材料员之材料员基础知识考试题库300道带答案(培优a卷).docx
- 2026年机械员考试题库含答案(轻巧夺冠).docx
- 2026年材料员之材料员基础知识考试题库300道【夺分金卷】.docx
- 2026年期货从业资格之期货法律法规考试题库500道(考点精练).docx
文档评论(0)