




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Tournament TreesWinner trees.Loser Trees.Winner Tree DefinitionComplete binary tree with n external nodes and n 1 internal nodes.External nodes represent tournament players.Each internal node represents a match played between its two children; the winner of the match is stored at the internal node.R
2、oot has overall winner.Winner Tree For 16 Playersplayermatch nodeWinner Tree For 16 Players4368157326945258Smaller element wins = min winner tree.361324253122121Winner Tree For 16 Players4368157326945258height is log2 n (excludes player level)361324253122121Complexity Of InitializeO(1) time to play
3、match at each match node.n 1 match nodes.O(n) time to initialize n-player winner tree.Winner Tree OperationsInitializeO(n) timeGet winnerO(1) timeReplace winner and replayO(log n) time More precisely Theta(log n)Tie breaker (player on left wins in case of a tie).Replace Winner And Replay436815732694
4、5258361324253122121Replace winner with 6.Replace Winner And Replay4368657326945258361324253122121Replay matches on path to root.Replace Winner And Replay4368657326945258361324253122121Replay matches on path to root.Replace Winner And Replay4368657326945258361324253122121Opponent is player who lost l
5、ast match played at this node.Loser TreeEach match node stores the match loser rather than the match winner.Min Loser Tree For 16 Players4368157326945258438Min Loser Tree For 16 Players43681573269452584683517Min Loser Tree For 16 Players436815732694525846835371629Min Loser Tree For 16 Players4368157
6、326945258468353725281649Min Loser Tree For 16 Players4368157326945258468353725581649Min Loser Tree For 16 Players4368157326945258468353725581649Min Loser Tree For 16 Players436815732694525846835372558264943681573269452584683537255826491WinnerComplexity Of Loser Tree InitializeStart with 2 credits at
7、 each node.Use one to pay for the match played at that node.Use the other to pay for the store of a left child winner.Total time is O(n).More precisely Theta(n).Winner43681573269452584683537255826491Replace winner with 9 and replay matches.959332Complexity Of ReplayOne match at each level that has a
8、 match node.O(log n)More precisely Theta(log n).Tournament Tree ApplicationsRun generation.k-way merging of runs during an external merge sort.Truck loading.Truck Loadingn packages to be loaded into truckseach package has a weighteach truck has a capacity of c tonsminimize number of trucksBin Packin
9、gn items to be packed into binseach item has a sizeeach bin has a capacity of c tonsminimize number of binsBin PackingTruck loading is same as bin packing.Truck is a bin that is to be packed (loaded).Package is an item/element.Bin packing to minimize number of bins is NP-hard.Several fast heuristics
10、 have been proposed.Bin Packing HeuristicsFirst Fit.Bins are arranged in left to right order.Items are packed one at a time in given order.Current item is packed into leftmost bin into which it fits.If there is no bin into which current item fits, start a new bin.Bin Packing HeuristicsFirst Fit Decr
11、easing.Items are sorted into decreasing order.Then first fit is applied.Bin Packing HeuristicsBest Fit.Items are packed one at a time in given order.To determine the bin for an item, first determine set S of bins into which the item fits.If S is empty, then start a new bin and put item into this new
12、 bin.Otherwise, pack into bin of S that has least available capacity.Bin Packing HeuristicsBest Fit Decreasing.Items are sorted into decreasing order.Then best fit is applied.PerformanceFor first fit and best fit:Heuristic Bins = (17/10)(Minimum Bins) + 2For first fit decreasing and best fit decreasing:Heuristic Bins = (11/9)(Minimum Bins) + 4Max
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 吉林一中2025年高三5月(三模)英语试题含解析
- 四川省成都外国语高级中学2025年高三全州仿真考试历史试题含解析
- 长岭县2025年数学五下期末联考试题含答案
- 江苏建筑职业技术学院《阿拉伯社会》2023-2024学年第二学期期末试卷
- 江苏省苏州市常熟市2025年高三下学期模块考试英语试题含解析
- 上海交通大学《现代汉语专业》2023-2024学年第一学期期末试卷
- 四川文化产业职业学院《诊断学基础实验》2023-2024学年第一学期期末试卷
- 内河船舶安全检查简要概述
- 环境污染案例分析与实践考核试卷
- 内河船舶货运市场调研与预测方法考核试卷
- 2024项目投资协议书
- 中考数学计算题练习100道(2024年中考真题)
- 我和我的祖国混声四部合唱简谱
- 家校沟通经验分享-沟通有方法教育有温度
- CJJ75-1997 城市道路绿化规划与设计规范
- 医学检验技术专业《临床实验室管理》课程标准
- 万城商业地产公司简介
- 快递驿站和快递公司保证金合同范本
- 校园茶餐厅设计说明
- 保密知识考试题库带答案(培优)
- 物流系统仿真技术智慧树知到期末考试答案章节答案2024年山东交通学院
评论
0/150
提交评论