- 1、本文档共25页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
Optimal Binary Search Tree课件
Optimal Binary Search Tree;1.Preface;2.Premise;3.Formula Prove;Because we have probabilities of searches for each key and each dummy key, we can determine the expected cost of a search in a given binary search tree T. Let us assume that the actual cost of a search is the number of nodes examined, i.e., the depth of the node found by the search in T,plus1. Then the expected cost of a search in T is : (The second statement)
E[ search cost in T]
= (i=1~n) ∑ pi .(depthT(ki)+1)
+ (i=0~n) ∑ qi .(depthT(di)+1)
=1 + (i=1~n) ∑ pi .depthT(ki)
+ (i=0~n) ∑ qi .depthT(di)
Where depthT denotes a node’s depth in the tree T.
;k2;By Figure (a), we can calculate the expected search cost node by node:
;And the total cost = (0.30 + 0.10 + 0.15 + 0.20 + 0.60 + 0.15 + 0.30 + 0.20 + 0.20 + 0.20 + 0.40 ) = 2.80
So Figure (a) costs 2.80 ,on another, the Figure (b) costs 2.75, and that tree is really optimal.
We can see the height of (b) is more than (a) , and the key k5 has the greatest search probability of any key, yet the root of the OBST shown is k2.(The lowest expected cost of any BST with k5 at the root is 2.85) ;Step1:The structure of an OBST;We need to use the optimal substructure to show that we can construct an optimal solution to the problem from optimal solutions to subproblems. Given keys ki ,…, kj, one of these keys, say kr (I ≦r ≦j), will be the root of an optimal subtree containing these keys. The left subtree of the root kr will contain the keys (ki ,…, kr-1) and the dummy keys( di-1 ,…, dr-1), and the right subtree will contain the keys (kr+1 ,…, kj) and the dummy keys( dr ,…, dj). As long as we examine all candidate roots kr, where I ≦r ≦j, and we determine all optimal binary search trees containing ki ,…, kr-1 and those containing kr+1 ,…, kj , we are guaranteed that we will find an OBST.;There is one detail worth nothing about “empty” subtrees. Suppose that in a subtree with keys ki,...,kj, we select ki as the root. By the above argument, ki ‘s left
您可能关注的文档
- New trends in entertainment technology (lead in)课件.ppt
- New-ceB5-6新编大学英语课件.ppt
- New York Fashion Show-PPT课件.ppt
- New-ceB5-6课件.ppt
- N-linked glycosylation-1课件.ppt
- News Headline课件.ppt
- News and festivals课件.ppt
- NEW-H3CNE第9章_网络设备文件管理课件.ppt
- New Zealand 新西兰概况课件.ppt
- News Reporting课件.ppt
- 2024年浙江省杭州市临安市上甘街道招聘社区工作者真题及参考答案详解一套.docx
- 2024年河南省许昌市长葛市石固镇招聘社区工作者真题含答案详解.docx
- 2024年河南省郑州市登封市大冶镇招聘社区工作者真题及参考答案详解.docx
- 2024年浙江省宁波市余姚市低塘街道招聘社区工作者真题及参考答案详解一套.docx
- 2024年浙江省丽水市莲都区峰源乡招聘社区工作者真题及答案详解1套.docx
- 2024年河南省郑州市中原区石佛镇招聘社区工作者真题及答案详解1套.docx
- 2024年浙江省杭州市萧山区河庄镇招聘社区工作者真题带答案详解.docx
- 2024年浙江省嘉兴市桐乡市河山镇招聘社区工作者真题含答案详解.docx
- 2024年河南省郑州市金水区未来路街道招聘社区工作者真题参考答案详解.docx
- 2024年浙江省宁波市慈溪市观海卫镇招聘社区工作者真题及参考答案详解一套.docx
最近下载
- 物资管理知识题库-填空题.doc VIP
- Yamaha 雅马哈 乐器音响 PSR-SX600 Owner's Manual (Traditional Chinese) 用户手册.pdf
- 2025年危险性较大工程项目领导带班制度.pdf VIP
- 安徽工程大学【个人简历】简单风格四页精美套装简历-简历模板.docx VIP
- 2024年其他类-化验员-水质化验员考试历年常考点试题带答案.docx VIP
- 中国粮油公司年度经营计划.ppt VIP
- 2024年其他类-化验员-水质化验员考试历年常考点试题带答案.docx VIP
- 2024年其他类-化验员-水质化验员考试历年常考点试题带答案版.docx VIP
- 株洲湘江四桥42米现浇箱梁贝雷支架施工技术方案.doc VIP
- GB50312-2016 综合布线系统工程验收规范.docx VIP
文档评论(0)