# randomized algorithms cs648

Post on 02-Jan-2016

25 views

Embed Size (px)

DESCRIPTION

Randomized Algorithms CS648. Lecture 3 Two fundamental problems Balls into bins Randomized Quick Sort Random Variable and Expected value. Balls into BINS Calculating probability of some interesting events. Balls into Bins. - PowerPoint PPT PresentationTRANSCRIPT

PowerPoint Presentation

Randomized AlgorithmsCS648 Lecture 3Two fundamental problemsBalls into binsRandomized Quick SortRandom Variable and Expected value1Balls into BINS

Calculating probability of some interesting events2Balls into Bins31 2 3 i n1 2 3 4 5 m-1 mBalls into BinsQuestion : What is the probability that there is at least one empty bin ?41 2 3 i n1 2 3 4 5 m-1 mBalls into Bins51 2 3 i n1 2 3 4 5 m-1 mBalls into Bins61 2 3 i n1 2 3 4 5 j m-1 mdisjointIndependentIndependentBalls into Bins71 2 3 i n1 2 3 4 5 j m-1 mBalls into Bins81 2 3 i n1 2 3 4 5 j m-1 mBalls into Bins9Express the event as union of some events Balls into Bins10Balls into Bins11Randomized Quick sort

What is probability of two specific elements getting compared ?12Randomized Quick Sort13Randomized Quick Sort14Not a feasible way to calculate the probability15Go 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.16Elements of A arranged in Increasing order of values171819Alternate SolutionUsing 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.20A Random Experiment:A Story of two friends21Viewing the entire experiment from perspective of A and B22

1 2 3 4 n-1 nAB

Viewing the entire experiment from perspective of A and B23

1 2 3 4 n-1 nAB

Viewing the entire experiment from perspective of A and B24AB

Viewing the entire experiment from perspective of A and B25AB

Viewing the entire experiment from perspective of A and B26AB

Viewing the entire experiment from perspective of A and B27A

B

probability theory

(Random variable and expected value) 28Random variable29

Randomized-Quick-Sorton array of size nNumber of HEADS in 5 tossesSum of numbers in 4 throws Number of comparisonsRandom variable30Many Random Variables for the same Probability spaceRandom Experiment: Throwing a dice two timesX : the largest number seenY : sum of the two numbers seen31

Expected Value of a random variable(average value)32X= aX= bX= cExamples33Can we solve these problems ?34Spend 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.

Recommended