- 1、本文档共35页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
第03章_查找树Search_Trees
Search Trees Dictionaries Search Trees Ordered Dictionaries Keys are assumed to come from a total order. New operations: closestKeyBefore(k) closestElemBefore(k) closestKeyAfter(k) closestElemAfter(k) Binary Search (§3.1.1) Binary search performs operation findElement(k) on a dictionary implemented by means of an array-based sequence, sorted by key at each step, the number of candidate items is halved terminates after O(log n) steps Example: findElement(7) Lookup Table (§3.1.1) A lookup table is a dictionary implemented by means of a sorted sequence We store the items of the dictionary in an array-based sequence, sorted by key We use an external comparator for the keys Performance: findElement takes O(log n) time, using binary search insertItem takes O(n) time since in the worst case we have to shift n/2 items to make room for the new item removeElement take O(n) time since in the worst case we have to shift n/2 items to compact the items after the removal The lookup table is effective only for dictionaries of small size or for dictionaries on which searches are the most common operations, while insertions and removals are rarely performed (e.g., credit card authorizations) Binary Search Tree (§3.1.2) A binary search tree is a binary tree storing keys (or key-element pairs) at its internal nodes and satisfying the following property: Let u, v, and w be three nodes such that u is in the left subtree of v and w is in the right subtree of v. We have key(u) ? key(v) ? key(w) External nodes do not store items An inorder traversal of a binary search trees visits the keys in increasing order Search (§3.1.3) To search for a key k, we trace a downward path starting at the root The next node visited depends on the outcome of the comparison of k with the key of the current node If we reach a leaf, the key is not found and we return NO_SUCH_KEY Example: findElement(4) Insertion (§3.1.4) To perform operation insertItem(k, o), we search for key k Assume k is not already in th
您可能关注的文档
- 高考复习生态问题分析思路专题一土地荒漠化.ppt
- 高考数学第二章第10讲.ppt
- 高速铁路第三章.ppt
- 立体几何总复习课件(必看).ppt
- 空调零售销售突破方案模板.ppt
- 鲍红光-产科出血的麻醉与处理.ppt
- 齿轮传动渐开线齿轮的基本参数与计算.ppt
- 齐鲁油投资说明.ppt
- 鸡群肌肉注射免疫.ppt
- 麦肯锡-节能控排—走向低碳经济.ppt
- 2024年河北张家口市经开区专业人才引进30名笔试备考题库及答案解析.docx
- 2024中石油深圳新能源研究院有限公司秋季招聘30人笔试备考试题及答案解析.docx
- 2024中铁十七局医院招聘笔试备考题库及答案解析.docx
- 2024山东济南市商河县城镇公益性岗位招聘40人笔试备考题库及答案解析.docx
- 2024年湖北国土资源职业学院非事业编工作人员招聘9人笔试备考题库及答案解析.docx
- 2024年黄冈武穴市公开招聘引进急需紧缺专业人才工作4人笔试备考题库及答案解析.docx
- 2024福建福州连江恒欣村镇银行秋季社会招聘若干人笔试备考试题及答案解析.docx
- 2024宁夏教师自主招聘准考证打印入口笔试备考题库及答案解析.docx
- 2024中国网络空间安全协会招聘2人笔试备考试题及答案解析.docx
- 2024福建共青团福州市晋安区委员会招聘劳务派遣人员的笔试备考试题及答案解析.docx
最近下载
- 办公用品订购合同范本.docx VIP
- WORD版本刻度尺-A4纸打印可用.doc
- 90nm逻辑产品Peeling缺陷的解决方案.pdf
- 神经系统的分级调节.pptx VIP
- 中建施工总平面布置图设计(69页).pdf
- 2024年公共卫生与预防医学继续教育平台“大学习”活动线上培训栏目考试题库(1392题).docx
- 北师大版(2023)必修第一册 Unit 2 Sports and Fitness单元教学设计.pdf VIP
- 2016-2023年长沙民政职业技术学院高职单招(英语/数学/语文)笔试历年参考题库含答案解析.docx
- 农业经济学-农业资金.ppt VIP
- 齐鲁医学神经系统疾病的辅助检查.ppt VIP
文档评论(0)