Download presentation

Presentation is loading. Please wait.

Published byJuliana Fleming Modified over 2 years ago

1
Randomized Algorithms Randomized Algorithms CS648 Lecture 3 Two fundamental problems Balls into bins Randomized Quick Sort Random Variable and Expected value Lecture 3 Two fundamental problems Balls into bins Randomized Quick Sort Random Variable and Expected value 1

2
BALLS INTO BINS CALCULATING PROBABILITY OF SOME INTERESTING EVENTS 2

3
Balls into Bins 3 1 2 3 … i … n 1 2 3 4 5 … m-1 m

4
Balls into Bins Question : What is the probability that there is at least one empty bin ? 4 1 2 3 … i … n 1 2 3 4 5 … m-1 m

5
Balls into Bins 5 1 2 3 … i … n 1 2 3 4 5 … m-1 m

6
Balls into Bins 6 1 2 3 … i … n 1 2 3 4 5 … j … m-1 m disjoint Independent

7
Balls into Bins 7 1 2 3 … i … n 1 2 3 4 5 … j … m-1 m

8
Balls into Bins 8 1 2 3 … i … n 1 2 3 4 5 … j … m-1 m

9
Balls into Bins 9 Express the event as union of some events …

10
Balls into Bins 10

11
Balls into Bins 11

12
RANDOMIZED QUICK SORT WHAT IS PROBABILITY OF TWO SPECIFIC ELEMENTS GETTING COMPARED ? 12

13
Randomized Quick Sort 13

14
Randomized Quick Sort 14 Not a feasible way to calculate the probability

15
15 Go through the next few slides slowly and patiently, pondering at each step. Never accept anything until and unless you can see the underlying truth yourself.

16
16 Elements of A arranged in Increasing order of values

17
17

18
18

19
19

20
ALTERNATE SOLUTION USING ANALOGY TO ANOTHER RANDOM EXPERIMENT Remember we took a similar approach earlier too: we used a coin toss experiment to analyze failure probability of Rand- Approx-Median algorithm. 20

21
A Random Experiment: A Story of two friends 21

22
Viewing the entire experiment from perspective of A and B 22 1 2 3 4 … n-1 n AB

23
Viewing the entire experiment from perspective of A and B 23 1 2 3 4 … n-1 n AB

24
Viewing the entire experiment from perspective of A and B 24 AB

25
Viewing the entire experiment from perspective of A and B 25 AB

26
Viewing the entire experiment from perspective of A and B 26 AB

27
Viewing the entire experiment from perspective of A and B 27 AB

28
PROBABILITY THEORY (RANDOM VARIABLE AND EXPECTED VALUE) 28

29
Random variable 29 Randomized- Quick-Sort on array of size n Number of HEADS in 5 tosses Sum of numbers in 4 throws Number of comparisons

30
Random variable 30

31
Many Random Variables for the same Probability space Random Experiment: Throwing a dice two times X : the largest number seen Y : sum of the two numbers seen 31

32
Expected Value of a random variable (average value) 32 Ω X= a X= b X= c

33
Examples 33

34
Can we solve these problems ? 34 Spend at least half an hour to solve these two problems using the tools you know. This will help you appreciate the very important concept we shall discuss in the next class.

Similar presentations

OK

Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu.

Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on porter's five forces Ppt on new zealand culture and people Ppt on different types of dance forms productions Ppt on duty roster samples Ppt on hospitality industry in india Ppt on object oriented programming language Ppt on drugs and medicines Ppt on energy giving foods Ppt on product advertising in cartoons Best ppt on body language