# 06 - QuickSort Data Structures and Algorithms Andrei...

This preview shows pages 1–5. Sign up to view the full content.

QuickSort Data Structures and Algorithms Andrei Bulatov

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Algorithms – Quicksort 6-2 Probability Reminder Sample space Event Probability Discrete random variable: A variable that takes values with certain probability Example: The amount of money you win buying a lottery ticket: there are 1000 tickets, 1 wins \$10000, 10 win \$100, the rest win nothing Pr[X = 10000] = 1/1000, Pr[X = 100] = 1/100, Pr[X = 0] = 989/1000
Algorithms – Quicksort 6-3 Random Variables Expectation Let X be a discrete random variable with values Then Example: E[your win] = 10000 · Pr[X = 10000] + 100 · Pr[X = 100] + 0 · Pr[X = 0] = 10000 · 1/1000 + 100 · 1/100 + 0 · 989/1000 = 11 One random variable interesting for us is the running time of some algorithm k v v , , 1 K ] Pr[ ] Pr[ ] [ 1 1 k k v X v v X v X E = + + = = K

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Algorithms – Quicksort 6-4 Properties of Random Variables Linearity: Let X , Y be discrete random variables, and α a number Then E[X + Y] = E[X] + E[Y] E[ α X] = α E[X] Example: We flip n fair coins. How many heads do we get on average? Let
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 13

06 - QuickSort Data Structures and Algorithms Andrei...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online