23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

called an event, <strong>and</strong> the probability function Pr is assumed to possess the follow<strong>in</strong>g<br />

basic properties with respect to events def<strong>in</strong>ed from S:<br />

1. Pr(ø) = 0.<br />

2. Pr(S) = 1.<br />

3. 0 ≤ Pr(A) ≤ 1, for any AS.<br />

4. If A,B S <strong>and</strong> A∩B = ø, then Pr(AυB) = Pr(A) +Pr(B).<br />

Two events A <strong>and</strong> B are <strong>in</strong>dependent if<br />

Pr(A∩B) = Pr(A)·Pr(B).<br />

A collection of events {A 1 , A 2 ,…, A n } is mutually <strong>in</strong>dependent if<br />

Pr(A i1 ∩ A i2 ∩…∩A ik ) = Pr(A i1 ) Pr(A i2 ) ···Pr(A ik ).<br />

for any subset {A i1 ,A i2 ,…,A ik }.<br />

The conditional probability that an event A occurs, given an event B, is denoted as<br />

Pr(A|B), <strong>and</strong> is def<strong>in</strong>ed as the ratio<br />

Pr(A∩B)/Pr(B),<br />

assum<strong>in</strong>g that Pr(B) > 0.<br />

An elegant way for deal<strong>in</strong>g with events is <strong>in</strong> terms of r<strong>and</strong>om variables. Intuitively,<br />

r<strong>and</strong>om variables are variables whose values depend upon the outcome of some<br />

experiment. Formally, a r<strong>and</strong>om variable is a function X that maps outcomes from<br />

some sample space S to real numbers. An <strong>in</strong>dicator r<strong>and</strong>om variable is a r<strong>and</strong>om<br />

variable that maps outcomes to the set {0,1}. Often <strong>in</strong> data structure <strong>and</strong> algorithm<br />

analysis we use a r<strong>and</strong>om variable X to characterize the runn<strong>in</strong>g time of a r<strong>and</strong>omized<br />

algorithm. In this case, the sample space S is def<strong>in</strong>ed by all possible outcomes of the<br />

r<strong>and</strong>om sources used <strong>in</strong> the algorithm.<br />

We are most <strong>in</strong>terested <strong>in</strong> the typical, average, or "expected" value of such a r<strong>and</strong>om<br />

variable. The expected value of a r<strong>and</strong>om variable X is def<strong>in</strong>ed as<br />

where the summation is def<strong>in</strong>ed over the range of X (which <strong>in</strong> this case is assumed to<br />

be discrete).<br />

Proposition A.19 (The L<strong>in</strong>earity of Expectation): Let X <strong>and</strong> Y be two r<strong>and</strong>om<br />

variables <strong>and</strong> let c be a number. Then<br />

916

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!