06 - QuickSort Data Structures and Algorithms Andrei...

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

View Full Document Right Arrow Icon
QuickSort Data Structures and Algorithms Andrei Bulatov
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online