HOMEWORK SOLUTIONS CSE 55 RANDOMIZED AND APPROXIMATION ALGORITHMS 1. Questio 1. a) The larger the value of k is, the smaller the expected umber of days util we get all the coupos we eed. I fact if = k the the umber of days we eed to collect every coupo is, because every day we have the choice to select 1 coupo out of k = coupos ad therefore the probability is 0 that we are ot able to select a distict coupo. The other extreme is if k = 1. The the problem reduces to the coupo collector problem as preseted i class. Therefore at worst, the same boud applies, H. To be more precise, let us calculate the expected umber of days we eed as a fuctio of k ad. Let X i = umber of attempts before you get i + 1 distict coupos. Let X = 1 X i. The the probability of the evet Y i that we get the (i+1)th distict coupo whe i k is ( i ( ) ( P (Y i ) = 1 ( k i =!(i! i!(! ( ) =!(i! k Here ( i is the umber of ways that you ca select k coupos out of i distict coupos you already have. This is divided by ( which is the umber of possible ways to select k coupos out of the total umber of coupos. As show i class, E(X i ) = 1. The Y P (Y i ) i evets are idepedet so: E(X) = 1 1 1 P (Y i ) =!(i!!(i! i!(! b) As show i Figure 1, the expected umber of days util all the coupos are collected decreases rapidly as k icreases. I this case, we have that k = c for c a fixed real costat with 0 c 1. Cosider!(i! i!(!!(i! whe > i k c. I the iterval i [c, 1], this is 1
CSE 55 RANDOMIZED AND APPROXIMATION ALGORITHMS 30 80 5 60 0 15 40 10 0 5 0 0 50 500 00 400 150 300 100 00 50 100 Figure 1. The expected umber of days util all the coupos are collected as a fuctio of k for specific values of. largest whe i = 1, whe it is!( 1 c)! ( 1)!( c)!. This is!( 1 c)! ( 1)!( 1 c)! ( 1)!( c)( 1 c)! ( 1)!( 1 c)! = ( c) = c Hece E(X) is bouded by /c, ad hece is O(). (See Figure.) c) Figure 1 shows that as k icreases, the expected umber of days to collect all the coupos rapidly decreases. The questio is: Whe c is fixed but grows without boud, what is the asymptotic growth rate? Whe k > 1, this ca take o loger (expected) tha the usual coupo collector, so the expected time is O( log ). Ca it be less? Compare the modified coupo collector problem with c coupos ad c give at a time with the usual coupo collector problem with coupos. The probability of gettig the last coupo i the coupo collector problem is 1, ad i the modified
HOMEWORK SOLUTIONS 3 00 150 100 50 c Figure. The expected umber of days util all the coupos are collected as a fuctio of c. oe it is 1 (c 1 c ) ( c c ) same (expected). = 1 c( 1) c = c = 1. So the time to get the last coupo is the c I selectig the lth coupo from the ed, i the basic coupo collector the probability is l. I the modified oe the probability of gettig ay specific oe of the l remaiig is 1, as we just saw. By the uio boud (Boole s iequality), the probability of gettig at least oe of the l caot exceed l. Hece gettig the last coupos i the modified coupo collectio problem takes a expected time at least as log as the basic coupo colector. The for coupos offered c at a time the expected time is at least H c /c, i.e. it is Θ( log ) because c is a costat.
4 CSE 55 RANDOMIZED AND APPROXIMATION ALGORITHMS. Questio. We represet the source ad destiatio vertices i biary represetatio as we did i class. Because we have a -dimesioal hypercube we eed bits to represet each of the vertices. Let Π : V V be a permutatio fuctio for a -dimesioal hypercube. We defie the permutatio ext, supposig without loss of geerality that is eve. Let D be the set of all the distict biary sequeces of legth. For all sequeces A D ad B D, for source vertex AB set the destiatio to be BA (Π(AB) BA.) This way, we make sure that give every source vertex there is a destiatio vertex ad it is ideed a permutatio. We use the same bit-fixig strategy as explaied i class. A bottleeck occurs at each of the / vertices {BB : B D, because / messages go through each of these odes (ad each oly ecouters oe of these bottleecks.) It follows that the total delay is at least / / 1 i; divide by to see that the average delay is Ω(). (Note that the value i the sum is approximately 1.) 3. Questio 3. Cosider a radom -colorig (idepedetly, color each edge red or blue). For a fixed set R of k vertices, let A R be the evet that the iduced subgraph of K o R is moochromatic. Clearly, P (A R ) = 1 (k ). Sice there are ( possible choices for R, the probability that at least oe of the evets A R occurs is at most ( 1 ( k ) < 1. Thus, with positive probability o evet A R occurs ad there is a two-colorig of K without a moochromatic K k, that is, R(k,. If k 3 ad we take = k/ the we get that R(k, > k/ for all k 3. 4. Questio 4. (a) A reasoable lower boud is obtaied by otig that I ca get at most ( k ) ew pairs of diers each ight ad I have to get ( ( ) by the ed. So ( ) / k ) = ( 1) is a k(k 1) reasoable boud. A better boud of ( 1) ca be obtaied by seeig that every dier has to k (k 1) be ivited o at least ( 1) ights. (k 1) (b) Defie X l as i the questio statemet. The E[X 0 ] = ( ). The crucial observatio is that E[X l+1 ] = E[X l ](1 k(k 1) ). Why is this true? ( 1) Cosider a pair that is ot yet covered after l ights. What is the chace that it will be covered toight? It is k(k 1). By liearity of expectatio the umber of ew ( 1)
HOMEWORK SOLUTIONS 5 pairs of diers o ight l + 1 is the E[X l ] k(k 1). Subtract these from E[X ( 1) l] to get E[X l+1 ]. Apply this repeatedly to get E[X N ] = ( ) (1 k(k 1) ( 1) )N. Whe E[X N ] < 1, there must be at least oe way to fiish the ivitatios after N ights. Usig the Markov iequality, whe E[X N ] < 1, the probability that we fiish withi N ights is at least 1. So we wat to solve ( ) (1 k(k 1) ( 1) )N < 1 for N. Now cosider ( ) N ( 1) k(k 1) ( 1) < 1. ( 1) Take logarithms ad multiply by -1. So log(( 1)) + N(log(( 1)) log(( 1) k(k 1))) > 0. N > log(( 1)) log(( 1)) log(( 1) k(k 1)). The smallest value of N satisfyig this is eough to get the desired probability of success. Oe ca estimate this to get simpler expressios for N. Whe k =, this is a coupo collector problem with ( ) coupos, so we expect the time to be O( log ). The time caot icrease as k icreases. (c) Let Y l be the umber of pairs of diers who have ot died together after l ights. Because we always select to hadle a umber of pairs that is at least the expectatio, Y l E[X l ]. I particular, whe E[X N ] < 1, Y N < 1 so Y N = 0, ad all pairs of diers have shared a dier. Note that Y l is ot a radom variable, rather it takes o a specific iteger value with certaity. 5. Questio 5. Let us cosider the graph G described i the questio. Suppose that it has m edges ad vertices. The k vertices we are after cosist of ay set of k vertices that iduce a subgraph of G with at least the average umber of edges over all k-vertex subgraphs. We are goig to pick the k vertices oe vertex at a time. Call a vertex i, ad put it i I if we decide to iclude it (we will ever remove it). Call a vertex out, ad put it i O if we decide ot to iclude it (we will ever add it). Let X be a radom variable that gives the umber of edges iduced o a radom k-vertex subgraph. Defie the coditioal expectatio E[X [I, O]] to be the expectatio of X coditioed o the iclusio of all vertices i I, the exclusio of all vertices of O, ad the radom selectio of k I vertices that are either i I or O.
6 CSE 55 RANDOMIZED AND APPROXIMATION ALGORITHMS Iitially the probability that a chose subgraph cotais a specific edge is E[X [, ]] which is just the expectatio a priori. We also ote that whe I O cotais all vertices, the radomess is goe, ad the expectatio is the actual umber of edges i the chose subgraph. The key observatio is that for ay vertex x I O, k I O k E[X [I, O]] = E[X [I {x}, O]] + E[X [I, O {x}]] I O I O To see this, compute the probability that a radom selectio of k I vertices from the I O that remai cotais, or does ot cotai, x. It is the same for every x. First treat boudary cases. Whe k I = 0, stop ad place all remaiig vertices i O. The we are guarateed to have realized at least the iitial expectatio. Whe k I = I O, place all remaiig vertices i I ad we have the same guaratee. Otherwise at least oe of E[X [I {x}, O]] or E[X [I, O {x}]] is at least as large as E[X [I, O]] ad we just eed to figure out which oe. Now focus o a specific edge e of G, ad cosider its probability of beig i the subgraph evetually chose. Suppose that we have already decided to iclude I ad exclude O, ad we wat to decide about icludig x. We compute its cotributio to the expectatio before decidig about x, whe x is added, ad whe x is excluded, as follows Cotributio of e to Expectatio Coditio o x, e E[X [I, O]] E[X [I {x}, O]] E[X [I, O {x}]] e O 0 0 0 e I, x e e I, x e e I =, x e k I I O k I k I 1 I O 1 k I I O 1 I O 1 0 (k I )(k I 1) ( I O )( I O 1) (k I )(k I 1) ( I O )( I O 1) (k I 1)(k I ) ( I O 1)( I O ) (k I )(k I 1) ( I O 1)( I O ) k I 1 I O 1 0 e I =, x e Now the idea is simple. Cout edges of each of the last four types give your curret selectio of I ad O. Compute the differeces betwee the expectatio of icludig x ad for excludig x usig the table above. Choose the larger oe, ad the proceed to the ext step (checkig the boudary cases agai to see if you are doe).