Discrete Mathematics University of Kentucky CS 275 Spring ... - MGNet
Discrete Mathematics University of Kentucky CS 275 Spring ... - MGNet
Discrete Mathematics University of Kentucky CS 275 Spring ... - MGNet
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Theorem: If X i , 1;i;n, are random variables on S and if a,b,R, then<br />
1. E(X 1 +X 2 +…+X n ) = E(X 1 )+E(X 2 )+…+E(X n )<br />
2. E(aX i +b) = aE(X i ) + b<br />
Pro<strong>of</strong>: Use mathematical induction (base case is n=2) for 1 and using the<br />
definitions for 2.<br />
Note: The linearity <strong>of</strong> E is extremely convenient and useful.<br />
Theorem: The expected number <strong>of</strong> successes when n Bournoulli trials is<br />
performed when p is the probability <strong>of</strong> success on each trial is np.<br />
Pro<strong>of</strong>: Apply 1 from the previous theorem.<br />
109<br />
Notes:<br />
• The average case complexity <strong>of</strong> an algorithm can be interpreted as the<br />
expected value <strong>of</strong> a random variable. Let S={a i }, where each possible input<br />
is an a i . Let X be the random variable such that X(a i ) = b i , the number <strong>of</strong><br />
operations for the algorithm with input a i . We assign a probability p(a i )<br />
based on b i . Then the average case complexity is E(X) = " p(a i<br />
)X(a i<br />
).<br />
a i<br />
!S<br />
• Estimating the average complexity <strong>of</strong> an algorithm tends to be quite<br />
difficult to do directly. Even if the best and worst cases can be estimated<br />
easily, there is no guarantee that the average case can be estimated without a<br />
great deal <strong>of</strong> work. Frankly, the average case is sometimes too difficult to<br />
estimate. Using the expected value <strong>of</strong> a random variable sometimes<br />
simplifies the process enough to make it doable.<br />
110