Download presentation

Presentation is loading. Please wait.

Published byMakena Stell Modified over 2 years ago

1
ENGG 2040C: Probability Models and Applications Andrej Bogdanov Spring 2014 The probabilistic method

2
Sometimes probability helps us solve problems that do not involve randomness at all.

3
Friends and “non-friends” Among every six people, there must be three that are all friends or are all “non-friends”. Proof : I must have at least 3 friends, or at least 3 non-friends If I have 3 friends: Either they are all non-friends with one another, Or a pair of them are friends, so the three of us are all friends.

4
Ramsey’s theorem Among every 4 n people, there must be n that are all friends or all “non-friends”. 4 n is a very large number! E.g. when n = 40, 4 n = 109 951 162 777 Do we really need that many people for that?

5
Erdös’s theorem There can be 2 n/2 - 1 people among which no n of them are all friends or all non-friends. Proof: Let N = 2 n/2 - 1 Probability model: Every pair is friends with probability ½, independently of the others. (for n ≥ 3 ) Let X be the number of groups of n people that are all friends or all non-friends.

6
Erdös’s theorem where X g is an indicator r.v. for the event “People in g are all friends or all non-friends.” E[X g ] = P(X g = 1) = 2∙2 -C(n, 2) E[X] = ∑ groups g E[X g ] ≤ N n ∙ 2 ∙ 2 -C(n, 2) = 2 n log N + 1 – n(n – 1)/2 < 1. X = ∑ groups g of n people X g, = C(N, n) ∙ 2 ∙ 2 -C(n, 2)

7
Erdös’s theorem Because E[X] 0. So the event X = 0 can happen. But X = 0 means there is no group of n people in which all are friends or all are non-friends. We used probability not to model any reality, but as a tool to solve a mathematical problem about friendships.

8
Quicksort 1. Choose a pivot stick p. 2. Go over all other sticks from left to right: Move all sticks shorter than p to the left of p 3. Recursively sort sticks to the left of p. 4. Recursively sort sticks to the right of p. and all sticks longer than p to the right of p.

9
Quicksort How to choose the pivot?

10
Quicksort Every pivot works, but some take us there faster than others We will measure the number N of pairwise comparisons done by the algorithm N depends on the input and on the choice of pivot We want to choose the pivot so N is small regardless of the input

11
Quicksort Example: What if we always chose the leftmost pivot? requires all possible C(n, 2) comparisons for n sticks For any fixed pivot-choosing strategy there is an input that entails all possible C(n, 2) comparisons

12
The randomized quicksort algorithm 1. Choose a pivot stick p uniformly at random. 2. Go over all other sticks from left to right: Move all sticks shorter than p to the left of p 3. Recursively sort sticks to the left of p. and all sticks longer than p to the right of p.

13
Analysis of randomized quicksort The number N of pairwise comparisons is now a random variable that depends on the pivot choices N = N 12 + N 13 +... + N (n-1)n where N ij is an indicator r.v. for the event “the i th and j th shortest sticks were compared at some point” N ij = 0 happens if sticks i and j were split before either was chosen as pivot

14
Analysis of randomized quicksort ij P(N ij = 0) = j – i + 1 j – i – 1 P(N ij = 1) = j – i + 1 2 E[N] = E[N 12 ] + E[N 13 ] +... + E[N (n-1)n ] = (n – 1) × 2/2+ (n – 2) × 2/3 +... + 1 × 2/n ≤ n × (2/2 + 2/3 +... + 2/n) ≤ 2n ln n.

15
What is next? If you like probability you will find lots of it... Computer networks [CSCI 4430, CSCI 5470] Reliable communication [IERG 3010, IERG 5154] Secure communication and computation [CSCI 5440] Algorithm design [CSCI 3160, CSCI 5450] Data privacy [CSCI 5520] The nature of efficient computation [CSCI 5170] Machine learning [CSCI 3320]

Similar presentations

OK

Comp 122, Spring 2004 Order Statistics. order - 2 Lin / Devi Comp 122 Order Statistic i th order statistic: i th smallest element of a set of n elements.

Comp 122, Spring 2004 Order Statistics. order - 2 Lin / Devi Comp 122 Order Statistic i th order statistic: i th smallest element of a set of n elements.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google