Tournament Trees

DownloadTournament Trees

Advertisement
Download Presentation
Comments
shona
From:
|  
(156) |   (0) |   (0)
Views: 167 | Added: 22-05-2012
Rate Presentation: 0 0
Description:
Winner Tree
Tournament Trees

An Image/Link below is provided (as is) to

Download Policy: Content on the Website is provided to you AS IS for your information and personal use only and may not be sold or licensed nor shared on other sites. SlideServe reserves the right to change this policy at anytime. While downloading, If for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.











- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -




1. Tournament Trees Winner trees. Loser Trees.

2. Winner Tree ? Definition 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.

3. Winner Tree For 16 Players Array representation.Array representation.

4. Winner Tree For 16 Players Match nodes actually store pointer to winner. When implementing, easier to play matches from 15 down to 1.Match nodes actually store pointer to winner. When implementing, easier to play matches from 15 down to 1.

5. Winner Tree For 16 Players Can use min heap of pointers to front records of runs for k-way merge. Replay is also O(log n). Need to access 2 children of each node on downward reinsert path.Can use min heap of pointers to front records of runs for k-way merge. Replay is also O(log n). Need to access 2 children of each node on downward reinsert path.

6. 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.

7. Winner Tree Operations Initialize O(n) time Get winner O(1) time Replace winner and replay O(log n) time More precisely Theta(log n) Tie breaker (player on left wins in case of a tie).

8. Replace Winner And Replay

9. Replace Winner And Replay

10. Replace Winner And Replay

11. Replace Winner And Replay

12. Loser Tree Each match node stores the match loser rather than the match winner.

13. Min Loser Tree For 16 Players

14. Min Loser Tree For 16 Players

15. Min Loser Tree For 16 Players

16. Min Loser Tree For 16 Players

17. Min Loser Tree For 16 Players

18. Min Loser Tree For 16 Players

19. Min Loser Tree For 16 Players

21. Complexity Of Loser Tree Initialize Start with 2 credits at 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). Start with 2 credits on each node; then charge match and store loser 1 unit to match node; store left child winner 1 unit to store node. Can do also with 1 credit/node. Play match, store loser and winner = 1 unit of work.Start with 2 credits on each node; then charge match and store loser 1 unit to match node; store left child winner 1 unit to store node. Can do also with 1 credit/node. Play match, store loser and winner = 1 unit of work.

23. Complexity Of Replay One match at each level that has a match node. O(log n) More precisely Theta(log n).

24. Tournament Tree Applications Run generation. k-way merging of runs during an external merge sort. Truck loading.

25. 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

26. 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 Memory allocation is a related problem. Best fit and first fit are 2 of the heuristics used in memory allocation.Memory allocation is a related problem. Best fit and first fit are 2 of the heuristics used in memory allocation.

27. 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 proposed.

28. Bin Packing Heuristics First 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.

29. Bin Packing Heuristics First Fit Decreasing. Items are sorted into decreasing order. Then first fit is applied.

30. Bin Packing Heuristics Best 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 bin. Otherwise, pack into bin of S that has least available capacity.

31. Bin Packing Heuristics Best Fit Decreasing. Items are sorted into decreasing order. Then best fit is applied.

32. Performance For first fit and best fit: Heuristic Bins <= (17/10)(Minimum Bins) + 2 For first fit decreasing and best fit decreasing: Heuristic Bins <= (11/9)(Minimum Bins) + 4

33. Max Winner-Tree For 16 Bins Use for first fit and first fit decreasing. Start with n bins with avail capacity c. Or, do some simple packing like examine objects left to right; put into bin 1 until you each an item that doesn?t fit, then go to bin 2 but do not look back at bin 1. O(n) time. Use the number of bins obtained this way to start first fit in an attempt to do better.Use for first fit and first fit decreasing. Start with n bins with avail capacity c. Or, do some simple packing like examine objects left to right; put into bin 1 until you each an item that doesn?t fit, then go to bin 2 but do not look back at bin 1. O(n) time. Use the number of bins obtained this way to start first fit in an attempt to do better.

34. Max Winner-Tree For 16 Bins

35. Complexity Of First Fit O(n log n), where n is the number of items.


Other Related Presentations

Copyright © 2014 SlideServe. All rights reserved | Powered By DigitalOfficePro