Presentation is loading. Please wait.

Presentation is loading. Please wait.

Quiz highlights 1.Probability of the song coming up after one press: 1/N. Two times? Gets difficult. The first or second? Or both? USE THE MAIN HEURISTICS:

Similar presentations


Presentation on theme: "Quiz highlights 1.Probability of the song coming up after one press: 1/N. Two times? Gets difficult. The first or second? Or both? USE THE MAIN HEURISTICS:"— Presentation transcript:

1 Quiz highlights 1.Probability of the song coming up after one press: 1/N. Two times? Gets difficult. The first or second? Or both? USE THE MAIN HEURISTICS: Compute probability of the opposite event. P(song never played after k presses) = P(not after 1)*P(not after 2)…. = (1 - 1/N) * (1 - 1/N)*… = (1 - 1/N)^k. Thus, P(k) = 1 - (1 - 1/N)^k 2. X = (1 - 1/N)^k. What do we do with products? Take a ln(X) = k*ln(1 - 1/N). Now, N >> 1 (N=100). So ln(1 - 1/N) ~ -1/N. Thus ln(X) ~ k*(-1/N) = -1 for k=N=100. Hence X ~ e^-1 ~ 1/3. Thus P(k) = 1 - X 3. Just use the MISSISSIPI formula, but don’t divide by 4!

2 HW highlight

3 The Pigeonhole (Dirichlet’s box) Principle If you have more pigeons than pigeonholes, when the pigeons fly into the holes at night, at least one hole has more than one pigeon.

4 The Pigeonhole (Dirichlet’s box) Principle often arises in computer science. For example, collisions are inevitable in a hash table because the number of possible keys exceeds the number of indices in the array. No hashing algorithm, no matter how clever, can avoid these collisions.

5 The Pigeonhole Principle Problem: Prove that there are at least 2 people in Roanoke that have the same number of hairs on their heads. Medical fact: people have up to 150,000 hairs. Census Bureau: Roanoke population is 200,000

6 The Pigeonhole Principle Problem: Prove that there are at least 2 people in Roanoke that have the same number of hairs on their heads. Holes = heads with N hairs, N from 0 to 150,000. Total: 150,001 Pigeons = Roanokeans = 200,000

7 The Pigeonhole Principle Problem: In a box there are 10 black socks and 12 blue socks and you need to get one pair of socks of the same colour. Supposing you can take socks out of the box only once and only without looking, what is the minimum number of socks you'd have to pull out at the same time in order to guarantee a pair of the same color?

8 The Pigeonhole Principle Problem: In a box there are 10 black socks and 12 blue socks and you need to get one pair of socks of the same colour. Supposing you can take socks out of the box only once and only without looking, what is the minimum number of socks you'd have to pull out at the same time in order to guarantee a pair of the same color? Answer: 3. To have at least one pair of the same colour (m = 2 holes, one per colour), using one pigeonhole per colour, you need only three socks (n = 3 pigeons). In this example, if the first and second sock drawn are not of the same colour, the very next sock drawn would complete at least one same colour pair. (m = 2)

9 The Pigeonhole (Dirichlet’s box) Principle If you have more pigeons than pigeonholes, when the pigeons fly into the holes at night, at least one hole has more than one pigeon. Problem: Every point on the plane is coloured either red or blue. Prove that no matter how the colouring is done, there must exist two points, exactly a mile apart, that are the same color.

10 The Pigeonhole Principle Problem: Every point on the plane is coloured either red or blue. Prove that no matter how the colouring is done, there must exist two points, exactly a mile apart, that are the same colour. 3 vertices of an equilateral triangle with the side of 1. Pigeons: Number of vertices: 3 Holes: Number of colours available: 2.

11 Pigeonhole Problem Given a unit square, show that if 5 pigeons land anywhere inside or on this square, then two of them must be at most sqrt(2)/2 units apart.

12 Pigeonhole Problem Given a unit square, show that if five points are placed anywhere inside or on this square, then two of them must be at most sqrt(2)/2 units apart. Sqrt(2)/2


Download ppt "Quiz highlights 1.Probability of the song coming up after one press: 1/N. Two times? Gets difficult. The first or second? Or both? USE THE MAIN HEURISTICS:"

Similar presentations


Ads by Google