- 1、本文档共18页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
§4AVLTreesTarget:Speedupsearching(withinsertionanddeletion)Tool:BinarysearchtreesrootsmalllargeProblem:AlthoughTp=O(height),buttheheightcanbeasbadasΩ(N)CHAPTER4Trees1/18
§4AVLTrees〖Example〗2binarysearchtreesobtainedforthemonthsoftheyearNovOctSeptMayMarJuneJulyDecAugAprFebJanJulyJuneMarMayOctSeptNovJanFebAugAprDecEnteredfromJantoDecAbalancedtree2/18Averagesearchtime=3.5Averagesearchtime=3.1Averagesearchtimeoftheskewtree=6.5
§4AVLTreesAdelson-Velskii-Landis(AVL)Trees(1962)【Definition】Anemptybinarytreeisheightbalanced.IfTisanonemptybinarytreewithTLandTRasitsleftandrightsubtrees,thenTisheightbalancediff(1)TLandTRareheightbalanced,and(2)|hL?hR|?1wherehLandhRaretheheightsofTLandTR,respectively.【Definition】ThebalancefactorBF(node)=hL?hR.InanAVLtree,BF(node)=?1,0,or1.582143778214354563217Theheightofanemptytreeisdefinedtobe–1.3/18
§4AVLTrees〖Example〗InputthemonthsMarMar0?1MayMay0NovNov0?1?2May0?1Nov00?2?1Mar000?ThetroublemakerNovisintherightsubtree’srightsubtreeofthetroublefinderMar.HenceitiscalledanRRrotation.Ingeneral:A?1B0BLBRALRRInsertionRRRotationA?2B?1BLBRALBLB0AALBR0AisnotnecessarilytherootofthetreeSinglerotation4/18
§4AVLTreesAugMay0?1Nov00?2?1Mar011Aug0AprApr01225/18Discussion1:Whatcanwedonow?
§4AVLTreesMay0?1Nov00?2?1Aug011?1Mar00Apr0JanJan01?12LRRotationMar0?1May0?1?2?1Aug010?1Jan00Apr0Nov0Ingeneral:A1B0BLARC0CRCLLRInsertionA2B?1BLARC?1CRCLORLRRotationBLARC0A?1or0CRB0or1CLORDoubleRotation6/18
§4AVLTreesDecJulyMar0?1May0?1?2?1Aug011?1Jan0Apr0Nov0July0Dec0FebFeb0?11?22RLRotationJuly0Dec0?1Aug01?2?1Jan010?1Feb00Apr0Mar0?1May0?1?2?11Nov0Ingeneral:A1B0BRALC0CLCRRLInsertionA?2B1BRALC?1CLCRORRLRotationBRALC0A0or1CLB?1or0CROR7/18
§4AVLTreesJuly0Dec0?1Aug01?2?1Jan010?1Feb00Apr0Mar0?1May0?1?2?11Nov0JuneOctSeptJune0?
您可能关注的文档
- 一章本章优化结.pptx
- 每波长连贯光学收发器coherent optical transceivers for more than 200gbs per wavelengthf4 Wavelength.pdf
- 六章长期股权投资三讲权益法.pdf
- 六章长期股权投资三讲权益法.pptx
- 公开课新目标八级下unit9period2 grammar.pdf
- 公开课新目标八级下unit9period2 grammar.pptx
- 丝网印花行业现状与来chinese printing industory finalized印刷企业确定.pdf
- 叔你在哪里课时.pdf
- 届高三一次全国大联考四川版理综卷.pdf
- 泰达灯光广场互动展服务.pptx
最近下载
- 人教版七下数学《相交线与平行线》单元作业设计 (60页) .pdf
- 《威尼斯商人》课件2.ppt VIP
- 视频监控系统安装服务方案(技术方案).docx
- 2025中考语文权威押题 信息必刷卷01(安徽专用)(试卷+解析).docx VIP
- FK6-1000巴马格加弹机电气说明书.pdf
- 山东省烟台市2024_2025学年高二数学下学期期中试题含解析.doc VIP
- 文言文试题专项训练 专题01 先秦时期-2025年高考历史临考提分(解析版).docx
- 2025中考语文权威押题 信息必刷卷05(安徽专用)(试卷+解析).docx VIP
- 2025中考语文权威押题 信息必刷卷03(安徽专用)(试卷+解析).docx VIP
- 《中国心力衰竭诊断和治疗指南2024》更新要点解读.pptx
文档评论(0)