lec05

Information about lec05

Published on February 29, 2008

Author: BAWare

Source: authorstream.com

Content

Tournament Trees:  Tournament Trees Winner trees. Loser Trees. Winner Tree – Definition:  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. Winner Tree For 16 Players:  Winner Tree For 16 Players Winner Tree For 16 Players:  Winner Tree For 16 Players 4 3 6 8 1 5 7 3 2 6 9 4 5 2 5 8 Smaller element wins => min winner tree. 3 6 1 3 2 4 2 5 3 1 2 2 1 2 1 Winner Tree For 16 Players:  Winner Tree For 16 Players 4 3 6 8 1 5 7 3 2 6 9 4 5 2 5 8 height is log2 n (excludes player level) 3 6 1 3 2 4 2 5 3 1 2 2 1 2 1 Complexity Of Initialize:  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:  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). Replace Winner And Replay:  Replace Winner And Replay Replace winner with 6. Replace Winner And Replay:  Replace Winner And Replay 4 3 6 8 6 5 7 3 2 6 9 4 5 2 5 8 3 6 1 3 2 4 2 5 3 1 2 2 1 2 1 Replay matches on path to root. Replace Winner And Replay:  Replace Winner And Replay 4 3 6 8 6 5 7 3 2 6 9 4 5 2 5 8 3 6 1 3 2 4 2 5 3 1 2 2 1 2 1 Replay matches on path to root. Replace Winner And Replay:  Replace Winner And Replay 4 3 6 8 6 5 7 3 2 6 9 4 5 2 5 8 3 6 1 3 2 4 2 5 3 1 2 2 1 2 1 Opponent is player who lost last match played at this node. Loser Tree:  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 4 3 6 8 1 5 7 3 2 6 9 4 5 2 5 8 4 3 8 Min Loser Tree For 16 Players:  Min Loser Tree For 16 Players 4 3 6 8 1 5 7 3 2 6 9 4 5 2 5 8 4 6 8 3 5 1 7 Min Loser Tree For 16 Players:  Min Loser Tree For 16 Players 4 3 6 8 1 5 7 3 2 6 9 4 5 2 5 8 4 6 8 3 5 3 7 1 6 2 9 Min Loser Tree For 16 Players:  Min Loser Tree For 16 Players 4 3 6 8 1 5 7 3 2 6 9 4 5 2 5 8 4 6 8 3 5 3 7 2 5 2 8 1 6 4 9 Min Loser Tree For 16 Players:  Min Loser Tree For 16 Players 4 3 6 8 1 5 7 3 2 6 9 4 5 2 5 8 4 6 8 3 5 3 7 2 5 5 8 1 6 4 9 Min Loser Tree For 16 Players:  Min Loser Tree For 16 Players 4 3 6 8 1 5 7 3 2 6 9 4 5 2 5 8 4 6 8 3 5 3 7 2 5 5 8 1 6 4 9 Min Loser Tree For 16 Players:  Min Loser Tree For 16 Players 4 3 6 8 1 5 7 3 2 6 9 4 5 2 5 8 4 6 8 3 5 3 7 2 5 5 8 2 6 4 9 Slide20:  4 3 6 8 1 5 7 3 2 6 9 4 5 2 5 8 4 6 8 3 5 3 7 2 5 5 8 2 6 4 9 1 Winner Complexity Of Loser Tree Initialize:  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). Slide22:  Winner Replace winner with 9 and replay matches. Complexity Of Replay:  Complexity Of Replay One match at each level that has a match node. O(log n) More precisely Theta(log n). Tournament Tree Applications:  Tournament Tree Applications Run generation. k-way merging of runs during an external merge sort. Truck loading. 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:  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:  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. Bin Packing Heuristics:  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. Bin Packing Heuristics:  Bin Packing Heuristics First Fit Decreasing. Items are sorted into decreasing order. Then first fit is applied. Bin Packing Heuristics:  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. Bin Packing Heuristics:  Bin Packing Heuristics Best Fit Decreasing. Items are sorted into decreasing order. Then best fit is applied. Performance:  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 Max Winner-Tree For 16 Bins:  Max Winner-Tree For 16 Bins Item size = 7 Max Winner-Tree For 16 Bins:  7 1 Max Winner-Tree For 16 Bins 6 4 3 6 1 5 7 3 2 6 9 4 5 2 5 8 4 6 5 7 6 9 5 8 7 9 8 9 9 Complexity Of First Fit:  Complexity Of First Fit O(n log n), where n is the number of items.

Related presentations


Other presentations created by BAWare

Integration into the SDLC
30. 08. 2007
0 views

Integration into the SDLC

hot topic
28. 09. 2007
0 views

hot topic

hispanics
01. 10. 2007
0 views

hispanics

zhang
10. 10. 2007
0 views

zhang

schwa
30. 08. 2007
0 views

schwa

aocc
30. 08. 2007
0 views

aocc

Pedersen
30. 08. 2007
0 views

Pedersen

Mining Sciences
30. 08. 2007
0 views

Mining Sciences

Intelligence Gathering mallorca
30. 08. 2007
0 views

Intelligence Gathering mallorca

ppt00021
30. 08. 2007
0 views

ppt00021

hoe wat over adsl
30. 11. 2007
0 views

hoe wat over adsl

The Healthy Potato
04. 12. 2007
0 views

The Healthy Potato

KINDS OF NOUNS
05. 11. 2007
0 views

KINDS OF NOUNS

CUPA 2007 Adv HW part 3
07. 11. 2007
0 views

CUPA 2007 Adv HW part 3

p Javier Carrillo
14. 11. 2007
0 views

p Javier Carrillo

High Intensity Interval Training
13. 12. 2007
0 views

High Intensity Interval Training

measurement
17. 12. 2007
0 views

measurement

OWASP AppSecEU2006 AJAX Security
30. 08. 2007
0 views

OWASP AppSecEU2006 AJAX Security

Feb05Sepracor
29. 11. 2007
0 views

Feb05Sepracor

aula17
28. 12. 2007
0 views

aula17

lab 04
11. 12. 2007
0 views

lab 04

cattle2000
31. 12. 2007
0 views

cattle2000

Mechanized Logging
02. 01. 2008
0 views

Mechanized Logging

Lightning Safety
03. 01. 2008
0 views

Lightning Safety

water problems
21. 11. 2007
0 views

water problems

mideastmaps
07. 01. 2008
0 views

mideastmaps

schulze
12. 10. 2007
0 views

schulze

Sept 17 03B
19. 11. 2007
0 views

Sept 17 03B

Empowerment2
29. 10. 2007
0 views

Empowerment2

LIU MIT 2006
28. 11. 2007
0 views

LIU MIT 2006

USFS Tourism
22. 11. 2007
0 views

USFS Tourism

omni partner guide pps
02. 10. 2007
0 views

omni partner guide pps

convergence
28. 12. 2007
0 views

convergence

sal mauro 061128
28. 02. 2008
0 views

sal mauro 061128

nypss nsta nov 2003
26. 06. 2007
0 views

nypss nsta nov 2003

Movies MC 061129 3
26. 06. 2007
0 views

Movies MC 061129 3

MOUG 08 2002
26. 06. 2007
0 views

MOUG 08 2002

mold
26. 06. 2007
0 views

mold

moilanen movies
26. 06. 2007
0 views

moilanen movies

MMC Bonato
26. 06. 2007
0 views

MMC Bonato

mm class 8
26. 06. 2007
0 views

mm class 8

Oceans 2005
26. 06. 2007
0 views

Oceans 2005

C3A6
04. 01. 2008
0 views

C3A6

Session8Massimiliano Claps
21. 03. 2008
0 views

Session8Massimiliano Claps

paper Columbia pipelines
30. 08. 2007
0 views

paper Columbia pipelines

CDW Ches99 Talk
05. 01. 2008
0 views

CDW Ches99 Talk

Marketing Mix IPG Presentation
26. 03. 2008
0 views

Marketing Mix IPG Presentation

Moab Marketing
27. 03. 2008
0 views

Moab Marketing

0Kim
30. 08. 2007
0 views

0Kim

Coglx to cultlx
22. 11. 2007
0 views

Coglx to cultlx

12 Igra 4pm
06. 12. 2007
0 views

12 Igra 4pm

Rao
28. 03. 2008
0 views

Rao

Goorevich Richard
30. 03. 2008
0 views

Goorevich Richard

06MYMRes2
09. 04. 2008
0 views

06MYMRes2

quickreview
10. 04. 2008
0 views

quickreview

MontanaDDpresentatio n060105a
13. 04. 2008
0 views

MontanaDDpresentatio n060105a

The Happy Monkey
29. 11. 2007
0 views

The Happy Monkey

cnea 376
20. 11. 2007
0 views

cnea 376

e know GV Presentation
17. 04. 2008
0 views

e know GV Presentation

SustainabilityCaseSt udies
22. 04. 2008
0 views

SustainabilityCaseSt udies

mark
30. 08. 2007
0 views

mark

Dialectal Differentiation
24. 11. 2007
0 views

Dialectal Differentiation

Chapter01
30. 08. 2007
0 views

Chapter01

n0102 SPIE1
26. 06. 2007
0 views

n0102 SPIE1

tues RMI cloonan
07. 12. 2007
0 views

tues RMI cloonan

Modi
26. 06. 2007
0 views

Modi

mne tools scripts kskassam
26. 06. 2007
0 views

mne tools scripts kskassam

hausmesse vortrag meyer
16. 11. 2007
0 views

hausmesse vortrag meyer

sjw
21. 12. 2007
0 views

sjw

stew cartons
17. 06. 2007
0 views

stew cartons

stellmach tim
17. 06. 2007
0 views

stellmach tim

Twelfth Night 2
17. 06. 2007
0 views

Twelfth Night 2

tuebingen seminar nov 04
17. 06. 2007
0 views

tuebingen seminar nov 04

TNG Presentation1
17. 06. 2007
0 views

TNG Presentation1

THE SCIENCE OF LOVE
17. 06. 2007
0 views

THE SCIENCE OF LOVE

t06B Functions Examples
17. 06. 2007
0 views

t06B Functions Examples

Sunny
17. 06. 2007
0 views

Sunny

28 1330 HARP rohacs hideg
18. 03. 2008
0 views

28 1330 HARP rohacs hideg

Water way Awareness
17. 06. 2007
0 views

Water way Awareness

Watergate Political Cartoons
17. 06. 2007
0 views

Watergate Political Cartoons

Valentine s PPT
17. 06. 2007
0 views

Valentine s PPT

USB FunctionDrv
17. 06. 2007
0 views

USB FunctionDrv

urban legends
17. 06. 2007
0 views

urban legends

unti 17Le 1 Funny stories
17. 06. 2007
0 views

unti 17Le 1 Funny stories

Understanding Political Cartoons
17. 06. 2007
0 views

Understanding Political Cartoons

Week2 Augustineandhisera
17. 06. 2007
0 views

Week2 Augustineandhisera

Tee
09. 10. 2007
0 views

Tee

seshun
13. 11. 2007
0 views

seshun

Locke 1 07
30. 08. 2007
0 views

Locke 1 07

ames tornado
05. 10. 2007
0 views

ames tornado

TEAM 9
08. 11. 2007
0 views

TEAM 9

Ferragina
23. 11. 2007
0 views

Ferragina

robo wk 4 controls
07. 01. 2008
0 views

robo wk 4 controls

ScottStroup
02. 11. 2007
0 views

ScottStroup

dyer w ref
04. 03. 2008
0 views

dyer w ref

act31sld
30. 08. 2007
0 views

act31sld

WA Final
17. 06. 2007
0 views

WA Final

EnB presentatie Fischbacher
30. 08. 2007
0 views

EnB presentatie Fischbacher

What to do in Harrisonburg
17. 06. 2007
0 views

What to do in Harrisonburg