Algorithms - Lecture 12 - Randomized Algorithms

本文深入探讨了随机算法中期望的线性性质,包括期望的计算公式和加法性质。通过举例说明了等待时间的期望和收集优惠券过程的期望数。接着,介绍了马尔可夫不等式和切比雪夫不等式,用于概率上界和下界的估计。此外,还讨论了二项分布、 Chernoff界限及其在球和箱问题中的应用,如特定箱负载的上限和最大负载的上限。最后,分析了特定箱负载和最小箱负载的下界。这些理论和不等式在概率论和算法分析中具有重要意义。
摘要由CSDN通过智能技术生成

1 Linearity of Expectation

1.1 Expectation E ( x ) = ∑ x x P ( x ) E(x)=\sum_x xP(x) E(x)=xxP(x)

1.2 E ( X + Y ) = E ( X ) + E ( Y ) E(X+Y)=E(X)+E(Y) E(X+Y)=E(X)+E(Y) for all X , Y X, Y X,Y

1.3 Ex 1, Expected waiting time for heads

  • Let the random variable X X X denote the number of flips of a p-biased coin until we get the first “heads”.
  • Indicator variable X i = 1 X_i=1 Xi=1 if the number of flips is at least i i i, 0 0 0 otherwise. E ( X i ) = ( 1 − p ) i − 1 E(X_i)=(1-p)^{i-1} E(Xi)=(1p)i1, X i X_i Xis are dependent.
  • X = ∑ i X i X=\sum_{i}X_i X=iXi
  • E ( X ) = ∑ i ( 1 − p i ) i − 1 = 1 p E(X)=\sum_i (1-p_i)^{i-1}=\frac{1}{p} E(X)=i(1pi)i1=p1

1.4 Ex 2, A coupon collector process

  • Suppose we repeatedly draw a uniformly random number from { 1 , … , n } \{1,\dots,n\} {1,,n} until we have drawn each number at least once.
  • What is the expected number of draws?
  • Partition into n n n phases,
    • Phase i i i begins once i − 1 i-1 i1 distinct integers have been drawn.
    • X i X_i Xi denote the number of draws in Phase i i i.
    • X X X denotes ∑ 1 ≤ i ≤ n X i \sum_{1\leq i\leq n}X_i 1inXi, X i X_i Xi like flip a n − ( i − 1 ) n \frac{n-(i-1)}{n} nn(i1) biased coin, E ( X i ) = n n − ( i − 1 ) E(X_i)=\frac{n}{n-(i-1)} E(Xi)=n(i1)n
    • E ( X ) = ∑ i ≤ i ≤ n E ( X i ) = ∑ 1 ≤ i ≤ n 1 i = n H n ≈ n ln ⁡ n E(X)=\sum_{i\leq i\leq n}E(X_i)=\sum_{1\leq i \leq n}\frac{1}{i}=nH_n\approx n\ln n E(X)=iinE(Xi)=1ini1=nHnnlnn

2 Markov and Chebyshev inequalities

2.1 Markov’s inequality (Nonnegative random variable X X X)

For any nonnegative random variable X X X and any a > 0 a>0 a>0.
P r ( X ≥ a ) ≤ E ( x ) a P_r(X\geq a)\leq \frac{E(x)}{a} Pr(Xa)aE(x)

2.2 E ( X Y ) = E ( X ) E ( Y ) E(XY)=E(X)E(Y) E(XY)=E(X)E(Y) if X X X and Y Y Y are independent

2.3 V a r ( x ) = E ( X 2 ) − E ( X ) 2 Var(x)=E(X^2)-E(X)^2 Var(x)=E(X2)E(X)2

Ex, variance of a p-biased coin flip, V a r ( X ) = p − p 2 Var(X)=p-p^2 Var(X)=pp2

2.4 Variance of a sum of independent random variables V a r ( X + Y ) = V a r ( X ) + V a r ( Y ) Var(X+Y)=Var(X)+Var(Y) Var(X+Y)=Var(X)+Var(Y)

Ex, variance of a series of p-biased coin flips, V a r ( ∑ X i ) = n p ( 1 − p ) Var(\sum X_i)=np(1-p) Var(Xi)=np(1p)

2.5 Chebyshev’s inequality (any random variable X X X)

P r ( ∣ X − E ( X ) ∣ ≥ a ) ≤ V a r ( x ) a 2 P_r(|X-E(X)|\geq a)\leq \frac{Var(x)}{a^2} Pr(XE(X)a)a2Var(x)

3 Chernoff bounds

3.1 Binomial distribution

For 1 ≤ i ≤ n 1\leq i\leq n 1in, let p i ∈ [ 0 , 1 ] p_i\in [0,1] pi[0,1], let X i X_i Xi be a 0-1 random variable such that P r ( X i = 1 ) = p i P_r(X_i=1)=p_i Pr(Xi=1)=pi, denote p = 1 n ∑ 1 ≤ i ≤ n p i p=\frac{1}{n} \sum_{1\leq i\leq n}p_i p=n11inpi, X = ∑ X i X=\sum X_i X=Xi, thus E ( X ) = n p E(X)=np E(X)=np.

3.2 Lower bound

P r ( X ≤ ( 1 − δ ) n p ) ≤ e − δ 2 n p / 2 P_r(X\leq (1-\delta)np)\leq e^{-\delta^2np/2} Pr(X(1δ)np)eδ2np/2
δ ∈ [ 0 , 1 ) \delta \in [0,1) δ[0,1)

3.3 Upper bound

P r ( X ≥ ( 1 + δ ) n p ) ≤ e − δ 2 n p / 3 P_r(X\geq (1+\delta)np)\leq e^{-\delta^2np/3} Pr(X(1+δ)np)eδ2np/3
δ ∈ [ 0 , 1 ) \delta \in [0,1) δ[0,1)

3.4 When p = 1 2 p=\frac{1}{2} p=21

P r ( X ≤ ( 1 − δ ) n / 2 ) ≤ e − δ 2 n / 2 P_r(X\leq (1-\delta)n/2)\leq e^{-\delta^2n/2} Pr(X(1δ)n/2)eδ2n/2
P r ( X ≥ ( 1 + δ ) n / 2 ) ≤ e − δ 2 n / 2 P_r(X\geq (1+\delta)n/2)\leq e^{-\delta^2n/2} Pr(X(1+δ)n/2)eδ2n/2
δ ∈ [ 0 , 1 ) \delta \in [0,1) δ[0,1)

4 Balls and bins

4.1 Balls and bins problems

Suppose we throw a series of balls independently and uniformly at random into n n n bins.

4.2 Upper bounding the load of a specific bin

Assume n n n balls into n n n bins uniformly and independently. X i X_i Xi denotes indicator variable that = 1 =1 =1 when ball i i i land into bin 1. X = ∑ i X i X=\sum_i X_i X=iXi denotes the load of bin 1 X ∼ B ( n , 1 / n ) X \sim B(n,1/n) XB(n,1/n).

P r ( X ≥ c ′ ln ⁡ n ln ⁡ ln ⁡ n ) ≤ n − c P_r(X\geq c'\frac{\ln n}{\ln \ln n})\leq n^{-c} Pr(Xclnlnnlnn)nc

4.3 Upper bounding maximum bin load

E i E_i Ei denotes bin i i i exceeds c ′ f ( n ) c'f(n) cf(n), where f ( n ) = ln ⁡ n ln ⁡ ln ⁡ n f(n)=\frac{\ln n}{\ln \ln n} f(n)=lnlnnlnn, we see P r ( E i ) ≤ n − c P_r(E_i)\leq n^{-c} Pr(Ei)nc, by union bound, the probability of bad events is ≤ n 1 − c \leq n^{1-c} n1c, the maximum load of any bin is O ( f ( n ) ) O(f(n)) O(f(n)) with high probability.

4.4 Lower bounding the load of a specific bin

P r ( X ≥ ε ′ f ( n ) ) ≥ n − ε P_r(X\geq \varepsilon'f(n) )\geq n^{-\varepsilon} Pr(Xεf(n))nε

4.5 Lower bounding the minimum bin load

Minimum less than ε ′ f ( n ) \varepsilon'f(n) εf(n) balls, ( 1 − n − ε ) n (1-n^{-\varepsilon})^n (1nε)n

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
《算法导论》Hardcover版的引言(Introduction to Algorithms - Hardcover Edition)是一本经典的计算机科学教材。该版本不仅在内容上与平装版相同,还具有精美的硬皮封面,能够更好地保护书籍,并增添一份高质感和专业感。 首先,这本书是由Thomas H. Cormen等四位作者共同编写。他们是计算机科学领域的权威人物,在算法研究和教育方面具有丰富的经验。这本书的目的是为计算机科学专业的学生和从业人员提供系统而全面的算法知识,帮助他们深入理解和应用算法。 《算法导论》Hardcover版首先介绍了算法设计和分析的基础知识,包括分治法、贪婪算法、动态规划和回溯法等。接着,书中详细阐述了各种经典算法,如排序、图算法、字符串匹配、高级数据结构等。此外,书中还介绍了算法的优化技巧和应用领域,例如算法的并行化和近似算法。 与平装版相比,Hardcover版的封面更加美观,书页由高品质纸张制成,更加耐用。这使得读者在长时间研究和使用这本书时,能够更好地保存它的完整性和精美外观。此外,Hardcover版也更加适合作为礼品或收藏品,体现了读者对该书的重视和对算法学习的热爱。 总之,《算法导论》Hardcover版是一本内容丰富、思想深刻的算法教材,通过系统化的介绍和实例,帮助读者深入理解和应用各种算法。同时,Hardcover版的精美外观和耐用性也增强了读者在日常使用和收藏方面的满意度。无论是学习算法的新手还是资深专家,都能从这本书中获得极大的收益。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值