Randomized Algorithms CS648 Lecture 14 Expected duration of a randomized experiment Part II 1 REVISITING SOME DISCRETE MATHEMATICS 2 Recurrence 1 ๐0 = 1 For any ๐ > ๐ , 1 2 ๐๐ = ๐๐โ๐ ๐ ๐ Question: What is the smallest value of ๐ such that ๐๐ โค for a given ๐ > ๐? Answer: ?? log 2 ๐ For any ๐ > ๐ , ๐0 = 1 ๐๐ = ๐ ๐๐โ๐ for some 0 < ๐ < ๐ ๐ ๐ Question: What is the smallest value of ๐ such that ๐๐ โค for a given ๐ > ๐? Answer: ??log1/๐ ๐ 3 Recurrence 2 ๐0 = For any ๐ > ๐ , ๐ ๐ ๐๐ = ๐๐โ๐ 2 ๐ ๐ Question: What is the smallest value of ๐ such that ๐๐ โค for a given ๐ > ๐? Answer: ??log 2 log 2 ๐ For any ๐ > ๐ , ๐0 = ๐ for some 0 < ๐ < ๐ ๐๐ = ๐๐โ๐ ๐ for some 1 < ๐ ๐ ๐ Question: What is the smallest value of ๐ such that ๐๐ โค for a given ๐ > ๐? Answer: ??log ๐ log1/๐ ๐ 4 DISTRIBUTED CLIENT-SERVER PROBLEM 5 Distributed Client-Server Problem โข โข โข โข โข There are ๐-clients and ๐-servers. Each client knows address of each server. Each client has a single job. It is a distributed computational environment. A server can execute only one job in one round. Aim: A distributed protocol to finish all jobs as quickly as possible. 6 Distributed Client-Server Problem Randomized protocol (one round) โข Each client sends a request to a server selected randomly uniformly and independently. โข Each server which receives one or more requests, accepts only one request and finishes the corresponding job. โข Each client, whose job is finished, leaves the system. โข The remaining clients repeat the same procedure in next round. Question: what is the expected number of rounds to finish all jobs? 7 Distributed Client-Server problem Randomized protocol 1 2 3 4 5 6 7 8 7 8 Clients It can be framed as our familiar ball-bin problem. ๏ Servers 1 2 3 4 5 6 8 Distributed Client-Server problem Randomized protocol 1 2 1 2 3 4 5 6 7 8 6 7 8 Balls Bins 3 4 5 9 Distributed Client-Server problem Randomized protocol Round 1 1 2 1 2 3 3 4 4 5 5 6 7 8 6 7 8 10 Distributed Client-Server problem Randomized protocol 3 1 2 3 4 4 5 6 7 8 7 8 11 Distributed Client-Server problem Randomized protocol Round 2 3 1 2 3 4 4 5 6 7 8 7 8 12 Distributed Client-Server problem Randomized protocol Round 3 8 1 2 3 4 5 6 7 8 13 CALCULATING EXPECTED NO. OF ROUNDS FIRST APPROACH 14 Distributed Client-Server problem Randomized protocol Round 1 1 2 3 1 2 3 ๐โ๐ โฆ ๐-1 ๐ ๐ ๐ : no. of balls leaving the system at the end of round ๐. E[๐] = ?? ๐ if ๐๐๐๐ ๐ leaves the systems in round ๐ ๐๐ = ๐ otherwise ๐= ๐ ๐๐ ๏จ ๐[๐] = = ๐ ๐[๐๐ ] ๐ ๐(๐๐ = ๐) Not so easy to find 15 Round 1 Distributed Client-Server problem Randomized protocol 1 2 3 1 2 3 ๐โ๐ ๐-1 โฆ ๐ ๐ ๐ : no. of balls leaving the system in round ๐. E[๐] = ??๐ โ ๐๐ฑ๐ฉ๐๐๐ญ๐๐ ๐ง๐จ. ๐จ๐ ๐๐ฆ๐ฉ๐ญ๐ฒ ๐๐ข๐ง๐ฌ ๐ ๐ =๐โ๐ ๐โ ๐ between Is there any relation of ๐empty = no. ๐โ ๐ bins and ๐ the system in round 1 no. of balls leaving ๐ฟ๐ : no. of balls remaining in the system after round ๐. E[๐ฟ๐ ] = ? ๐ ๐ 16 Distributed Client-Server problem Round ๐ + ๐ Randomized protocol 1 1 2 ๐ 2 ๐ ๐-1 โฆ E[๐ฟ๐ ] = ๐ ๐ ๐ ๐ฟ๐ : no. of balls at the end of round ๐. ๐ E[๐ฟ๐+๐ | ๐ฟ๐ = ๐] =โค?? ๐ 17 Distributed Client-Server problem Randomized protocol ๐ Lemma1 : After round ๐ + ๐, the expected number of balls left is less than th ๐ fraction of the balls after round ๐. ๐๐ = ๐ฟ๐ : ๐ fraction of balls in the system after round ๐. ๐ Lemma 1 implies E[๐๐+๐ ] โค ? ?๐๐ ๐ ๏จ If everything goes as expected, then Round No. of balls in the system Fraction of balls in the system 0 ๐ 1 1 ๐/๐ ๐/๐ 2 < ๐/๐๐ < ๐/๐๐ This table gives the intuition for the expected no. of rounds but it directly does not help us to calculate the expected no. of rounds ? It also does not directly help to get a high prob. Bound. Convince yourself before proceeding further. 18 Distributed Client-Server problem Randomized protocol ๐ Lemma: After round ๐ + ๐, the expected no. of balls is less than th fraction ๐ of the balls after round ๐. ๐ ๐ Definition: round ๐ + ๐ is good if ๐๐+๐ < ๐๐ , and bad otherwise. ๐ โค P(a round is bad) = ??๐ ๏จ P(a round is good) > ๐ โค ๐ Use Markovโs Inequality ๐ ๐ Question: After how many good rounds will there be no ball left ? Expected no. of rounds =โค??๐ ๐ฅ๐จ๐ ๐ ๐ ๐ฅ๐จ๐ ๐ ๐ Use Recurrence 1 Each round is good independent of other rounds. 19 Distributed Client-Server problem Randomized protocol Theorem: The Randomized protocol will terminate in expected O(๐ฅ๐จ๐ ๐ ๐) rounds. This bound is very loose. Can you see why ? 20 An important insight that we missed Question: What is the cause of multiple rounds for a ball ? Answer: presence of other competing balls INSIGHT As the algorithm proceeds: โข The number of these competing balls reduce โข but the number of bins remain unchanged ๏จ Chances of a ball to leave the system increases as the algorithm proceeds. 21 CALCULATING EXPECTED NO. OF ROUNDS WITH NEW INSIGHT 22 Distributed Client-Server problem Randomized protocol Partitioning experiment into stages Stage 1: The number of balls > Stage 2: The number of balls โค Stage 1 ๐ ๐ ๐ ๐ ๐ ๐ง๐จ. ๐จ๐ ๐๐๐ฅ๐ฅ๐ฌ โค ๐ Stage 2 Expected no. of rounds in Stage 1 : 4. Expected no. of rounds in Stage 2 : ?? 23 CALCULATING EXPECTED NO. OF ROUNDS IN STAGE 2 24 Distributed Client-Server problem Randomized protocol Round ๐ + ๐ 1 2 1 ๐ 2 3 โฆ ๐-1 ๐ ๐ฟ๐ : no. of balls at the end of round ๐. ๐ ๐ ๐ ๐๐จ๐โ๐ง๐จ๐ง๐๐ฆ๐ฉ๐ญ๐ฒ ๐โ ๐๐ข๐ง๐ฌ E[๐ฟ๐+๐ | ๐ฟ๐ = ๐] = ??๐ โ ๐ง๐จ. ๐ โค๐โ๐ ๐โ ๐โ ๐ ๐ ๐ + ๐ ๐ ๐๐ ๐ ๐ ๐ =๐โ๐ โ ๐ ๐ ๐ ๐ ๐ We need๐a reasonably bound ๐ good upper ๐ ๐ ๐ for this ๐โ๐ =๐โ ๐ + ๐ โค โ + โฆ ๐ ๐ ๐๐ ๐ ๐ ๐๐ expression = ๐ ๐ 25 Distributed Client-Server problem Randomized protocol Round ๐ + ๐ 1 1 2 ๐ 2 3 ๐-1 โฆ ๐ฟ๐ : no. of balls at the end of round ๐. ๐ ๐ E[๐ฟ๐+๐ | ๐ฟ๐ = ๐] = โค ?? ๐ ๐ E ๐๐ = ๐ฟ๐ : ๐ ๐ฟ๐+๐ | ๐ ๐ ๐ ๐ฟ๐ = ๐ =โค?? ๐ ๐ ๐ ๐๐ โค ๐๐ ๐ fraction of balls at the end of round ๐. ๐ ๐ E[๐๐+๐ ] =โค?? ๐๐ ๐ 26 Distributed Client-Server problem Randomized protocol Lemma: If ๐๐ is the fraction of balls at end of round ๐ in stage 2, the expected ๐ fraction of balls at the end of round ๐ + ๐ will be at most ๐๐ ๐ . ๐ ๐ ๐๐ โค ๐ Definition: round ๐ + ๐ is good if ๐๐+๐ โค ๐๐ ๐ , and bad otherwise. ๏จ ๐ P(a round is bad) =< ?? ๐ ๐ P(a round is good) โฅ ๐ Use Markovโs Inequality Question: After how many good rounds will there be no ball left ? โค ๐ฅ๐จ๐ ๐ ๐ฅ๐จ๐ ๐ ๐ Expected no. of rounds = โค ??๐ ๐ฅ๐จ๐ ๐ ๐ฅ๐จ๐ ๐ ๐ Use Recurrence 2 27 Distributed Client-Server problem Randomized protocol Theorem: The expected number of rounds taken by the Randomized protocol is at most ๐ + ๐ ๐ฅ๐จ๐ ๐ ๐ฅ๐จ๐ ๐ ๐. 28 Distributed Client-Server problem Randomized protocol Points to Ponder : โข Why did we analyze the random variable ๐๐ and not ๐ฟ๐ ? โข Why did we introduce the two stages ? โข Do you find any similarity in the analysis with that of of Quick sort concentration? โข Can you also achieve lower bound of ๐(๐ฅ๐จ๐ ๐ ๐ฅ๐จ๐ ๐ ๐) on the expected number of rounds ? (this question is only for those whose aim is more than just grade A ) โข Can you achieve high probability bound on the number of rounds ? 29 RUMOR SPREADING 30 Rumor Spreading There are ๐ persons in a city. On day ๐, a person comes to know a rumor. The following protocol is repeated from day ๐ : โข Each person knowing the rumor does the following - Picks phone number of a randomly selected person - Calls him/her and communicate the rumor. Question: What is the expected number of days until everyone knows the rumor? 31 Rumor Spreading Question: What is the minimum number of days until everyone knows the rumor? Answer: ๐ฅ๐จ๐ ๐ ๐ Number of people knowing the rumor can only double in a day. 32 Rumor Spreading Theorem (it should surprise you): 1. The entire city comes to know the rumor in O(๐ฅ๐จ๐ ๐ ๐) expected days. 2. The entire city comes to know the rumor in O(๐ฅ๐จ๐ ๐ ๐) days with high probability. 33 Rumor Spreading Intuition 1: In the beginning, there are few persons who know the rumor. As a result โข The chances of selecting a person who does not know the rumor is more. โข The chances of collisions are also few. ๏จ As long as the no. of people knowing the rumor is less than c๐, for some suitable c < 1, the no. of people knowing the rumor should increase by a factor ๐ > ๐ every day. Intuition 2: Once there are more than c๐ persons knowing the rumor, the probability of a person unaware of rumor to get a phone call about rumor should be high. Can you use these two intuitions to partition the algorithm into stages ? 34 Rumor Spreading Partition the experiment into stages Select some c < 1 suitably. Stage 1: the number of people knowing the rumor is less than c๐ Stage 2: the number of people knowing the rumor is more than c๐ Stage 1 Stage 2 ๐ง๐จ. ๐จ๐ ๐ฉ๐๐จ๐ฉ๐ฅ๐ ๐ค๐ง๐จ๐ฐ๐ข๐ง๐ ๐ซ๐ฎ๐ฆ๐จ๐ซ > c๐ 35 EXPECTED NO. OF DAYS IN STAGE 2 36 Rumor Spreading In the beginning of Stage 2: the no. of people knowing the rumor > c๐ . โข Pick any person ๐ not knowing the rumor. โข Show that he/she will know the rumor in ๐(๐ฅ๐จ๐ ๐ ๐) days with high probability. โข Use Union theorem to conclude that the number of days in Stage 2 is ๐(๐ฅ๐จ๐ ๐ ๐) with high probability. 37 EXPECTED NO. OF DAYS IN STAGE 1 38 It is left as a home work to be discussed in some future class. I shall be happy to see a correct solution by some of you in the next class. 39
© Copyright 2026 Paperzz