CS 01 Schlag Jauary 6, 1999 Witer `99 CS 01: Adversary argumets This hadout presets two lower bouds for selectio problems usig adversary argumets ëku73, HS78, FG76ë. I these proofs a imagiary adversary called a oracle is created to force a algorithm to use the maximum umber of comparisos to solve the problem. The adversary's task is to determie the outcomes of comparisos i a maer which impedes the progress of the algorithm, ad yet is still cosistet. The outcomes of comparisos are cosistet as log as there are ever three keys A, B ad C with AéB, B é Cad C é A. That is, at aytime the comparisos form a partial order o the keys. A selectio algorithm ca be viewed as a touramet i which players participate i a sequece of pairwise matches. Assumig that each player has a distict skill level ad always plays at this level, the outcomes of matches are determied solely by these skill levels. These skill levels are ot kow. Oly by playig a match ca the skill levels of two players be compared. The better player always wis the match ad the outcomes are always cosistet sice they are based o a èhiddeè total orderig of the players. The three quatities of iterest i selectio problems are: 1. V k èè, the umber of comparisos ecessary to determie the k th player out of players,. U k èè, the umber of comparisos ecessary to determie the set cosistig of the top k players out of players, ad 3. W k èè, the umber of comparisos ecessary to determie the 1 st ; d ;:::;k th players out of players. These three quatities are related as follows: U k èè V k èè W k èè: The ærst iequality follows from the observatio that if you have determied through comparisos that x is the k th player the you also must have idetiæed the k, 1 players better tha x as well as the, k players worse tha x. I the ext sectio it is show that W èè =V èè =, +dlog e, ad i the followig sectio it is show that d 3 e, matches is ecessary ad suæciet for ædig the top ad bottom players. More recet results are preseted i ëbj85ë. Fidig the top two players Result 1: The top two players ca be foud i, +dlog e matches. Proof: Cosider the followig algorithm èschedule of matchesè to æd the ærst ad secod players: 1. First hold a sigle elimiatio touramet for the players. That is, pair up the players i b c matches, ad repeat the process with the udefeated players util oe udefeated player, x, remais. 1
. Play a secod sigle elimiatio touramet amog the m players who were defeated by x i the ærst touramet. Sice each player loses at most oce i a sigle elimiatio touramet ad at the ed oly oe player is udefeated, there are exactly, 1 losses ad hece, 1 matches. So the ærst touramet has exactly, 1 matches. Likewise, the umber of matches i the secod touramet is m, 1 where m is the umber of players who participated, lost to x i the ærst touramet. To determie m, cosider the umber of rouds played i the ærst touramet. I each roud of a sigle elimiatio tourmaet the players are paired ad d e players remai for the ext roud. Hece there will be at most dlog e rouds. I each roud x will defeat oe player, so m = dlog e. Summig the umber of matches played i the two touramets we obtai,, +dlog e: Result : Ay algorithm for ædig the ærst ad secod players will require at least, +dlog e matches. Proof: Suppose we have a arbitrary algorithm A for ædig the ærst ad secod player. Sice A is completely arbitrary we ca assume othig about the matches that A arrages. We ivet a æctitious adversary for A called a oracle as follows. As the matches orgaized by A are played our oracle keeps track of the followig iformatio: 1. let TOP = fcurretly udefeated playersg,. for ay player x TOP, let Domèx; 0è = fxg 3. for ay player x TOP ad ié0, let Domèx; iè=fplayers whose ærst defeat was to a player i Domèx; i, 1è g, 4. let Domèxè = S 1 i=0 Domèx; iè, ad 5. let Wièxè = jdomèx; 1èj. Our oracle uses the followig rules to determie the outcome of matches: 1. I a match betwee two players curretly i TOP, the player with the larger Wièè value will wi. If the two players have the same Wièè value the the wier is selected arbitrarily.. I a match betwee a player curretly i TOP ad a player ot i TOP, the player i TOP wis. 3. If either player is curretly i TOP, the the wier of the match is selected arbitrarily i a maer cosistet with the outcome of previous matches. The outcomes of the matches determied by our oracle are always cosistet sice the wier is always a udefeated player i the ærst two rules ad the outcome i rule 3 is selected to esure cosistecy. Iitially each player y belogs to Domèyè ad TOP. Whe y suæers its ærst loss, the oracle's secod rule esures that y loses to player z which is also i TOP. Soy alog with all of the other players i Domèyè joi Domèzè. Hece at aytime durig the matches each player belogs to Domèzè for some player z curretly i TOP. Whe the algorithm termiates there is oly oe player i TOP, say x, ad all of the players are i Domèxè.
Claim: After k matches ay player x still i TOP satisæes, jdomèxèj Wièxè : è1è Proof of Claim: By iductio o the umber of matches, k. Base: k = 0. No matches have bee played so jdomèxèj =1= 0 = Wièxè for all players. Step: Assume the claim is true after the ærst k, 1 matches ad cosider the k th match ad a player x still i TOP after this match. Note that sice x is still udefeated after the k th match, x either wo or did ot play ithek th match. Case 1 x did ot play i the k th match. I this case, we had jdomèxèj Wièxè before the match. Wièxè does't chage sice x does't play. Is it possible for Domèxè tochage? The aswer is o sice a player would joi Domèxè oly if it is curretly i TOP ad loses to a player i Domèxè èother tha x i this caseè. However, such a loss is ot possible accordig to the oracle's secod rule. Sice either Domèxè or Wièxè chages, Equatio è1è still holds after the match. Case x played y who was ot i TOP before the k th match. Sice y was ot i TOP, agai either Domèxè or Wièxè chages sice this is ot y's ærst defeat ad Equatio è1è still holds after the match. Case 3 x played y who was i TOP before the k th match. Accordig to the oracle's ærst rule, we have Wièxè Wièyè sice x wo. After the match Domèxè will become Domèxè ë Domèyè ad we have, jdomèxè ë Domèyèj jdomèxèj + jdomèyèj Wièxè + Wièyè æ Wièxè = Wièxè+1 : Sice after the match Wièxè will go up by 1, the Equatio è1è will still hold. Whe algorithm A termiates there will be oly oe player i TOP, say x. Sice all players will be i Domèxè, we have Wièxè jdomèxèj = ; or Wièxè dlog e: Cosider the players i Domèx; 1è. There are Wièxè of them. Each of them suæered their ærst defeat to x. Ayoe of these players that does ot lose a secod match, could be the secod best player. Algorithm A caot rule them out as secod best players, sice they have oly bee show to be worse tha x. I order to determie the secod best player, algorithm A must have arraged matches i which all but oe of the players i Domèx; 1è lost a secod time. The umber of matches played correspods exactly to the umber of losses. There are, 1 ærst losses ad at least Wièxè, 1 secod losses, so the umber of matches used by A is at least, +dlog e: 3
Fidig the top ad bottom players Result 3: The top ad bottom players ca be foud i d 3 e, matches. Proof: Cosider the followig algorithm èschedule of matchesè to æd the ærst ad last players: 1. First hold a sigle elimiatio touramet for the players. That is, pair up the players i b c matches, ad repeat the process with the udefeated players util oe udefeated player, x, remais.. Collect the d e players who did ot wi i the ærst roud of the previous touramet. èif is odd this will iclude the player who did ot play i the ærst roud.è Play a touramet with these players i which the loser advaces to the ext roud rather tha the wier. That is, pair up the players i matches, ad repeat the process with the wiless players util oe wiless player, z, remais. After the ærst touramet all but oe player is udefeated so the top player has bee determied i, 1 matches. The oly players who have ot wo ay matches are those that lost or possibly did ot play i the ærst roud. All the other players have wo at least oe match ad therefore caot possibly be the worst player. So to determie the worst player, matches are played amog the at most d e players who are still wiless. After the secod touramet all but oe player, z, will have wo a match. Oly z will be wiless ad so z is the worst player. The secod touramet requires d e,1 matches so altogether, a total of d 3 e, matches are played. Result 4: Fidig the top ad bottom players requires d 3 e, matches. Proof: As before we assume a arbitrary algorithm A for ædig the ærst ad last players ad we ivet a æctitious adversary for A called a oracle. Durig the sequece of matches arraged by A we keep track of the followig types of players. U is the group of players that have ever played; they are utested. W is the group of players that have played ad ever lost; they are wiers. L is the group of players that have played ad ever wo; they are losers. B is the group of players that have both wo ad lost matches; they are both losers ad wiers. After m matches we will represet the state of the touramet byèu; w; l; bè where u, w, l, ad b are the umbers of players i U, W, L, ad B respectively. The iitial state before ay matches are played is è; 0; 0; 0è ad at the ed, whe the top ad bottom players are kow, the state must be è0; 1; 1;, è. How the state chages after a match depeds o the group memberships of the wier ad loser; the state trasistios are give i Table 1. If wier If loser is i is i U W L B U èu, ;w+1;l+1;bè èu, 1;w;l;b+1è èu, 1;w+1;l;bè èu, 1;w+1;l;bè W èu, 1;w;l+1;bè èu; w, 1;l;b+1è èu; w; l; bè èu; w; l; bè L èu, 1;w;l;b+1è èu; w, 1;l, 1;b+è èu; w; l, 1;b+1è èu; w; l, 1;b+1è B èu, 1;w;l+1;bè èu; w, 1;l;b+1è èu; w; l; bè èu; w; l; bè Table 1: If the curret state is èu; w; l; bè the after a match the ext state ca be foud i the row ad colum correspodig to the groups èbefore the matchè cotaiig the match's wier ad loser. Our oracle tries to impede the progress of the algorithm by miimizig the chage i state. It decides outcomes of matches as follows: 4
1. A player i W always wis agaist a player ot i W.. A player i L always loses agaist a player ot i L. 3. Otherwise the wier is selected arbitrarily i a maer cosistet with the outcome of previous matches. The outcome is cosistet sice players i L ca always lose without violatig cosistecy ad players i W ca always wi without violatig cosistecy. I Table the outcomes prohibited by the oracle have bee oted. All players start i U,, must move tob while oe player moves to W ad If wier If loser is i group is i group U W L B U èu, ;w+1;l+1;bè ot possible èu, 1;w+1;l;bè èu, 1;w+1;l;bè W èu, 1;w;l+1;bè èu; w, 1;l;b+1è èu; w; l; bè èu; w; l; bè L ot possible ot possible èu; w; l, 1; b + 1è ot possible B èu, 1;w;l + 1;bè ot possible èu; w; l; bè èu; w; l; bè Table : Table 1 modiæed to reæect state chages which the oracle will ot allow. oe to L. We ca view each match as trasferrig uits from u to b, leavig oe uit behid i both w ad l. I the remaiig possible state chages, there is o match which trasfers uits from u to b, so trasferrig a uit from u to b must be accomplished by trasferrig it ærst to w or l ad the to b. Hece a total è, è + =, uit trasfers must occur. All matches trasfer at most oe uit with the exceptio of matches betwee two players i U, but at most b c matches of this type ca be played. The remaiig,, b c uits would have to be trasferred oe at a time. Thus the miimum umber of matches ecessary to accomplish all the trasfers is 3 +,, =,, =, : Refereces ëbj85ë ëfg76ë ëhs78ë Samuel W. Bet ad Joh W. Joh. Fidig the media requires comparisos. I Proceedigs of the 17 th ACM Symposium o Theory of Computig, pages 13í16, 1985. Frak Fusseegger ad Harold N. Gabow. Usig compariso trees to derive lower bouds for selectio problems. I Proceedigs of the 17 th IEEE Symposium o Foudatios of Computer Sciece, pages 178í18, 1976. Ellis Horowitz ad Sartaj Sahi. Fudametals of Computer Algorithms. Computer Sciece Press, Rockville, Marylad, 1978. ëku73ë Doald E. Kuth. The Art of Computer Programmig: Sortig ad Searchig. Addiso Wesley, Readig, Massachusetts, 1973. 5