Download presentation

Presentation is loading. Please wait.

Published byCecil Barton Modified over 2 years ago

1
Data Structures and Algorithms (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Dr. Sumanta Guha Slide Sources: CLRS “Intro. To Algorithms” book website (copyright McGraw Hill) adapted and supplemented

2
CLRS “Intro. To Algorithms” Ch. 5: Probabilistic Analysis and Randomized Algorithms

3
Probability Practice If the reward for rolling a dice is the number of dollars that the face up shows, what is the expected reward? What does this mean? E.g., if this were an actual game how much would you be willing to pay to play? If a coin is tossed 5 times, what is the probability of 0 heads, 1 head, 2 heads, …? If a coin is tossed 5 times what is expected number of heads? What does this mean? How do we calculate it? Two ways: (a) Let X be the random variable whose value is the number of heads E(X) = ∑ x=0..5 x * Pr(X=x) (b) Let X i = I{coin i is heads} Note: I(event) = 1, if event occurs; 0, if it doesn’t Then X = X 1 + X 2 + X 3 + X 4 + X 5 Therefore, E(X) = E(X 1 ) + E(X 2 ) + E(X 3 ) + E(X 4 ) + E(X 5 ) indicator variable

5
How many times do we expect to hire a new assistant? Let X be the random variable whose value is the number of times. Let X i = I{candidate i is hired} Then X = X 1 + X 2 + … + X n Therefore, E(X) = E(X 1 ) + E(X 2 ) + … + E (X n ) What is E(X i ), the probability that the i th candidate is hired? In other words, what is the probability the i th candidate is the best of the first i candidates? Answer: 1/i Therefore, E(X) = 1 + 1/2 +1/3 + … + 1/n ≈ log e n

6
Guarantee randomness, no matter what the input!

7
Randomly Permuting the Input Array Assuming all priorities P[i ] are distinct, prove that the procedure produces a uniform random permutation. Prove that the procedure produces a uniform random permutation.

8
5.4.1 Birthday Paradox How many people must there be in a room before there is a 50% chance that two share a birthday? 5.4.2 Ball and bins n balls are randomly tossed into b bins. Expectedly, how many balls fall into a given bin? Expectedly, how many balls must one toss until a given bin is hit at least once? Expectedly, how many balls must one toss until every bin is hit at least once? 5.4.3 Streaks Suppose we toss a fair coin n times. What is the longest streak of heads one expects to see? First, try to estimate the probability that there will be a streak of length k.

9
Problems Ex. 5.1-2 Ex. 5.1-3 Ex. 5.2-1 Ex. 5.2-2 Ex. 5.2-4 Ex. 5.4-2 Ex. 5.4-6 Prob. 5-2

Similar presentations

OK

Games of probability What are my chances?. Roll a single die (6 faces). –What is the probability of each number showing on top? Activity 1: Simple probability:

Games of probability What are my chances?. Roll a single die (6 faces). –What is the probability of each number showing on top? Activity 1: Simple probability:

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on alternative sources of energy can save this earth Ppt on depth first search algorithms Ppt on regional trade agreements in africa Ppt on abstract art Ppt on conceptual art pioneer Free ppt on components of food Ppt on national education day nepal Ppt on media research council Ppt on recycling of waste Ppt on intelligent manufacturing manchester