Title: Ti = indicator random variable of the event
1Ti indicator random variable of the event
that i-th throw results in a tail ET
ET1 ET6 6(1/2) 3
P(T3) P(H3) binomial(6,3)/26 5/16 lt 1/2
2EXi,j ½ (consider
only iltj)
X?Xi,j EX n(n-1) /4
1? iltj? n
3?
T 1 (1/2) 0 (1/2) ( T T ) T 1 T
4There exists c such that T(n) ?
T(n/2)T(n/3)cn.We need to show that there
exists d such that
T(n) ? dn for all n.
Induction step T(n) ? T(n/2) T(n/3) cn ?
dn/2 dn/3 cn ?
dn (c-d/6)n ? dn, taking d6c.
5l ? m1
6if B ? Am then
7Reverse(a,b) for i from a to ?ab? do
swap(Ai,Aab-i)
1,.,k,k1,.,n k,.,1,k1,.,n k,.,1,n,.,k1 k
1,.,n,1,.,k
Rotate(k) Reverse(1,k) Reverse(k1,n)
Reverse(1,n)
8- find the median m of A
-
? m
m
? m
sum S
3) if S\geq C then recurse on An/2..n
else recurse on A1..n/2 with
CC-S
9T(n) T(n/2) O(n)
3) if S\geq C then recurse on An/2..n
else recurse on A1..n/2 with
CC-S
10Coupon collector problem
n coupons to collect What is the expected number
of cereal boxes that you need to buy?
11Coupon collector problem
Assume that a dart throw is uniform in the
circle. Let p be The fraction occupied by the
bulls eye.
Expected number of darts needed to hit the
bulls eye ?
12Coupon collector problem
Assume that a dart throw is uniform in the
circle. Let p be The fraction occupied by the
bulls eye.
Expected number of darts needed to hit the
bulls eye ?
1/p
13What is the expected number of boxes that I buy
in k-th phase ? k-th phase when I have k
different Kinds of coupons.
EX0 1 EXk ? EXn-1 n
14What is the expected number of boxes that I buy
in k-th phase ? k-th phase when I have k
different Kinds of coupons.
EX0 1 EXk n/(n-k) EXn-1 n
15What is the expected number of boxes that I buy
in k-th phase ? k-th phase when I have k
different Kinds of coupons.
n-1
n
n
1
XX0X1Xn-1 ? n ?
n-k
k
k0
k1
? (n ln n)
16What is the expected number of boxes that I buy
in k-th phase ? k-th phase when I have k
different Kinds of coupons.
n-1
n
n
1
XX0X1Xn-1 ? n ?
n-k
k
k0
k1
? (n ln n)
EXEX0EXn-1
17Harmonic numers
n
?
1
? 1ln n
ln n ?
k
k1
18Randomized algorithm for median
SELECT k-th element
for random x
1)
x
ltx
gtx
R
L
2) recurse on the appropriate part
19Randomized algorithm for median
Las Vegas algorithm
(never makes error, randomness only influences
running time)
The identity testing algorithm was Monte Carlo
algorithm with 1 sided error.
20Markov inequality
For non-negative random variable X
P(X gt a.EX) lt 1/a P(X ? a.EX) ? 1/a
21Variance
For a random variable X V X
E (X-EX)2
What is the variance of Xthe number on a
(6-sided) dice ?
22Variance
For a random variable X V X
E (X-EX)2
Y (X-EX)2
P( Y gt a.EY ) lt 1/a
P( (X-EX)2 gt a.VX ) lt 1/a
P( (X-EX)2 gt b2.EX2 ) lt VX/(b2 EX2)
VX
1
P( X-EX gt b.EX ) lt
b2
EX2
23Chebychevs inequality
VX
1
P( X-EX gt b.EX ) lt
b2
EX2
P( (1-b)EX ? X ? (1b)EX )
gt
VX
1
1 -
b2
EX2