算法和数据结构12.ppt

  1. 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
算法和数据结构12

2004-3 L.Chen TOURNAMENT TREES Chapter 10 Tournament Trees Winner trees. Loser Trees. Winner Tree Complete 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. Root has overall winner. Winner Tree For 16 Players Winner Tree For 16 Players Winner Tree For 16 Players Complexity Of Initialize O(1) time to play match at each match node. n – 1 match nodes. O(n) time to initialize n player winner tree. Winner Tree Operations Initialize O(n) time Get winner O(1) time Remove winner and replay O(log n) time More precisely Theta(log n) Tie breaker (player on left wins in case of a tie). Replace Winner And Replay Replace Winner And Replay Replace Winner And Replay Replace Winner And Replay Loser Tree Each match node stores the match loser rather than the match winner. Min Loser Tree For 16 Players Min Loser Tree For 16 Players Min Loser Tree For 16 Players Min Loser Tree For 16 Players Min Loser Tree For 16 Players Min Loser Tree For 16 Players Min Loser Tree For 16 Players Complexity Of Loser Tree Initialize One match at each match node. One store of a left child winner. Total time is O(n). More precisely Theta(n). Complexity Of Replay One match at each level that has a match node. O(log n) More precisely Theta(log n). Applications Tournament Tree: Run generation. k-way merging of runs during an external merge sort. Truck loading. Truck Loading n packages to be loaded into trucks each package has a weight each truck has a capacity of c tons minimize number of trucks Bin Packing n items to be packed into bins each item has a size each bin has a capacity of c tons minimize number of bins Bin Packing Truck 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 have been propos

文档评论(0)

317960162 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档