Professional Documents
Culture Documents
• Basics of probability
• Random Variable
• Some basic probability distributions
• Skip List
• Mark Operation
Randomized Algorithm
• Its step are not only determined by the
previous step.
• it is determined by the prior steps as well as
output of the random number generator.
• Here we don't have worst case scenario.
instead we calculate the probability of running
time exceeding certain threshold value.
Confidence bound
• n−exponential probability – The amount of
resource
n
used is at most αf(n) with probability
1−O(β ) , β > 1.
• n−polynomial probability – The amount of
resource used is at most αf(n) with probability
c
1−O(n ) .
• n−log probability – The amount of resource
used is at most αf(n) with probability
c
1−O(log(n ) ) .
Contd.
• n−constant probability – The amount of
resource used is at most αf(n) with probability
α
1−O(β ) .
Basics of probability
• Pr(φ)=0
c
• Pr(E )=1−Pr(E)
• Pr(E1) ≤ Pr(E2) if E1 ⊆ E2
• Pr(E1 ∪ E2) = Pr(E1) + Pr(E2) − Pr(E1 ∩ E2) ≤
Pr(E1) + Pr(E2) (Boole’s inequality)
Contd.
Conditional probability.
• Pr(E1/E2) =Pr(E1 ∩ E2) , provided Pr(E2) = 0.
Pr(E2)
• Independent Event.
Baye’s Rule .
Pr(E2/E1).Pr(E1)
Pr(E1/E2) =
Pr(E2)
Random Variable
• Binomial Distribution
R(X) = {0, 1, 2, . . . , n}
n k n-k
Pr(X = k) = b(k,n,p) = ( )p q for k = 0,1,...,n
K
Contd.
• Geometric distribution
K-1
R(X) = {1,2,...,∞} , Pr(X = k) = q p, for k =
1,2,...,∞
• Negative Binomial distribution
R(X) = {0,1,2,...} ,
K-1 n K-n
Pr(X = k) = ( n-1 ) p q if k ≥ n
Pr(X = k) = 0 if 0 ≤ k < n
Sum of Random variables
Sn = X1 + X2 + · · · + Xn.
Where X1,X2 … Xn are independent random
variables.
Properties :
1. If Xi is a Bernoulli random variable with
parameter p then X is a binomial random
variable with parameters n and p.
Contd.
2. If Xi is a geometric random variable with
parameter p, then X is a negative binomial
with parameters n and p.
3. If Xi is a (negative) binomial random variable
with parameters r and p then X is a (negative)
binomial random variable with parameters nr
and p.
Skip List
• Data structures implemented using
randomness.
• Operation are very simple comparable to
operation on linked list.
• Performance equivalent to balanced tree
structures
Skip List
• Key Set
S = { k1 , k2 , k3 …… kn}.
S = S0 ⊇ S1 ⊇ S2 ⊇ ··· ⊃ Sr = φ
Implementation of skip list
• Each Si will be implemented as List Li .
• Calculation of Expectation of r
∞
E(r) = Pr( r ≥ i )
i=1
4Log(n)
∞
= Pr( r ≥ i ) + Pr ( r ≥ i )
I=1 4log(n) + 1
Contd.
E(r) ≤ 4Log(n) + 1
Therefore
E(r) = O(log n)
Space Complexity
The space complexity, | SL | is given by
|SL|=Z1 +Z2 +···+Zn +n+2r+2.
we know that r = O(log n), let calculate
Z = Z1 + Z2 + · · · + Zn.
Since Z is a negative binomial distribution
Pr(Z > 4n) = Pr(X < n) where X is a binomial
distribution with parameters 4n and p
Contd.
Let us assume p = ½
From Chernoff bound we get
n 3n
Pr( X < n ) ≤ (2n/n) (2n/3n)
-n
Pr( X < n ) ≤(27/16)