版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 深度解析(2026)《GBT 34211-2017铁矿石 高温荷重还原软熔滴落性能测定方法》
- 新型护理技术实操康复护理康复训练云计算支持课件
- 2026年万安第二中心幼儿园招聘备考题库有完整答案详解
- 2026年福州国企下属公办幼儿园公开招聘教职工人员42人备考题库及答案详解(易错题)
- 2026年春季学期青园梓枫小学教师招聘备考题库及答案详解(夺冠系列)
- 广州铁路职业技术学院2026年第一批引进急需专业人才10人备考题库及答案详解一套
- 2026年内江高新园区管理有限责任公司面向社会公开招聘工作人员的备考题库及答案详解(易错题)
- 2026年宁波和丰产业园(集团)有限公司招聘备考题库完整参考答案详解
- 2026年国家空间科学中心空间环境探测重点实验室空间环境探测载荷工程技术人员招聘备考题库及完整答案详解
- 2026年上海市同济口腔医院(同济大学附属口腔医院)实验技术员招聘备考题库及完整答案详解一套
- 2026渤海银行招聘面试题及答案
- 2026年呼和浩特职业学院单招职业适应性测试模拟试题及答案解析
- 工地试验室作业指导书(公路水运)
- 合作意向协议书模板
- 部编人教版一年级上册语文复习计划及教案
- TCADERM 3050-2023 狂犬病被动免疫制剂使用规范
- 人教版二年级数学下册 5 混合运算 第2课时 没有括号的两级混合运算(教学课件)
- 福建省泉州市2022-2023学年高一上学期期末教学质量监测化学试题(含答案)
- 英语book report简单范文(通用4篇)
- 船舶建造 监理
- YY/T 1447-2016外科植入物植入材料磷灰石形成能力的体外评估
评论
0/150
提交评论