SlideShare uma empresa Scribd logo
1 de 25
Randomized Algorithms
CS648

Lecture 2
• Randomized Algorithm for Approximate Median
• Elementary Probability theory
1
RANDOMIZED MONTE CARLO ALGORITHM
FOR
APPROXIMATE MEDIAN
This lecture was delivered at slow pace and its flavor was that of a
tutorial.
Reason: To show that designing and analyzing a randomized
algorithm demands right insight and just elementary probability.

2
A simple probability exercise

3
4
Approximate median
Definition: Given an array A[] storing n numbers and ϵ > 0, compute an
element whose rank is in the range [(1- ϵ)n/2, (1+ ϵ)n/2].

Best Deterministic Algorithm:
• “Median of Medians” algorithm for finding exact median
• Running time: O(n)
• No faster algorithm possible for approximate median
Can you give a short proof ?

5
½ - Approximate median
A Randomized Algorithm
Rand-Approx-Median(A)
1. Let k  c log n;
2. S  ∅;
3. For i=1 to k
4.
x  an element selected randomly uniformly from A;
5.
S  S U {x};
6. Sort S.
7. Report the median of S.
Running time: O(log n loglog n)

6
Analyzing the error probability of
Rand-approx-median
n/4

Left Quarter

Elements of A arranged in
Increasing order of values

3n/4

Right Quarter

When does the algorithm err ?
To answer this question, try to characterize what
will be a bad sample S ?

7
Analyzing the error probability of
Rand-approx-median
n/4

Elements of A arranged in
Increasing order of values

Left Quarter

3n/4

Median of S

Right Quarter

Observation: Algorithm makes an error only if k/2 or more elements
sampled from the Right Quarter (or Left Quarter).

8
Analyzing the error probability of
Rand-approx-median
n/4

Elements of A arranged in
Increasing order of values

3n/4

Right Quarter

Left Quarter

¼

Exactly the same as the coin
tossing exercise we did !

9
Main result we discussed

10
ELEMENTARY PROBABILITY THEORY
(IT IS SO SIMPLE THAT YOU UNDERESTIMATE ITS ELEGANCE AND POWER)

11
Elementary probability theory
(Relevant for CS648)
• We shall mainly deal with discrete probability theory in this course.
• We shall take the set theoretic approach to explain probability theory.
Consider any random experiment :
o Tossing a coin 5 times.
o Throwing a dice 2 times.
o Selecting a number randomly uniformly from [1..n].
How to capture the following facts in the theory of probability ?
1. Outcome will always be from a specified set.
2. Likelihood of each possible outcome is non-negative.
3. We may be interested in a collection of outcomes.
12
Probability Space

Ω

13
Event in a Probability Space

A

Ω

14
Exercises

A randomized algorithm can also be viewed as a random experiment.
1. What is the sample space associated with Randomized Quick sort ?
2. What is the sample space associated with Rand-approx-median
algorithm ?

15
An Important Advice
In the following slides, we shall state well known equations
(highlighted in yellow boxes) from probability theory.
• You should internalize them fully.
• We shall use them crucially in this course.
• Make sincere attempts to solve exercises that follow.

16
Union of two Events

A

B

Ω

17
Union of three Events

A

B

C

Ω

18
Exercises

19
Conditional Probability

20
Exercises
• A man possesses five coins, two of which are double-headed, one is
double-tailed, and two are normal. He shuts his eyes, picks a coin at
random, and tosses it. What is the probability that the lower face of the
coin is a head ? He opens his eyes and sees that the coin is showing heads;
what it the probability that the lower face is a head ? He shuts his eyes
again, and tosses the coin again. What is the probability that the lower
face is a head ? He opens his eyes and sees that the coin is showing heads;
what is the probability that the lower face is a head ? He discards this
coin, picks another at random, and tosses it. What is the probability that it
shows heads ?

21
Partition of sample space and
an “important Equation”

B

Ω

22
Exercises

23
Independent Events

P(A ∩ B) = P(A) · P(B)

24
Exercises

25

Mais conteúdo relacionado

Mais procurados

Continuous probability Business Statistics, Management
Continuous probability Business Statistics, ManagementContinuous probability Business Statistics, Management
Continuous probability Business Statistics, ManagementDebjit Das
 
Chapter 4 part2- Random Variables
Chapter 4 part2- Random VariablesChapter 4 part2- Random Variables
Chapter 4 part2- Random Variablesnszakir
 
Introduction to Probability
Introduction to ProbabilityIntroduction to Probability
Introduction to ProbabilityVikas Gupta
 
Discreet and continuous probability
Discreet and continuous probabilityDiscreet and continuous probability
Discreet and continuous probabilitynj1992
 
Probability concepts for Data Analytics
Probability concepts for Data AnalyticsProbability concepts for Data Analytics
Probability concepts for Data AnalyticsSSaudia
 
Continous random variable.
Continous random variable.Continous random variable.
Continous random variable.Shakeel Nouman
 
Sample Space and Event,Probability,The Axioms of Probability,Bayes Theorem
Sample Space and Event,Probability,The Axioms of Probability,Bayes TheoremSample Space and Event,Probability,The Axioms of Probability,Bayes Theorem
Sample Space and Event,Probability,The Axioms of Probability,Bayes TheoremBharath kumar Karanam
 
Heteroskedasticity
HeteroskedasticityHeteroskedasticity
Heteroskedasticityhalimuth
 
Chapter 1 random variables and probability distributions
Chapter 1   random variables and probability distributionsChapter 1   random variables and probability distributions
Chapter 1 random variables and probability distributionsAntonio F. Balatar Jr.
 
Probability 2(final)
Probability 2(final)Probability 2(final)
Probability 2(final)Khadiza Begum
 
Rational functions
Rational functionsRational functions
Rational functionstidtay81
 
02 Machine Learning - Introduction probability
02 Machine Learning - Introduction probability02 Machine Learning - Introduction probability
02 Machine Learning - Introduction probabilityAndres Mendez-Vazquez
 
binomial distribution
binomial distributionbinomial distribution
binomial distributionZarish Qaiser
 
Discrete probability distribution (complete)
Discrete probability distribution (complete)Discrete probability distribution (complete)
Discrete probability distribution (complete)ISYousafzai
 
Probability class 9 ____ CBSE
Probability class 9 ____ CBSEProbability class 9 ____ CBSE
Probability class 9 ____ CBSESmrithi Jaya
 
Binomial distribution
Binomial distributionBinomial distribution
Binomial distributionRobert Tinaro
 
Basic probability theory and statistics
Basic probability theory and statisticsBasic probability theory and statistics
Basic probability theory and statisticsLearnbay Datascience
 

Mais procurados (20)

Continuous probability Business Statistics, Management
Continuous probability Business Statistics, ManagementContinuous probability Business Statistics, Management
Continuous probability Business Statistics, Management
 
Chapter 4 part2- Random Variables
Chapter 4 part2- Random VariablesChapter 4 part2- Random Variables
Chapter 4 part2- Random Variables
 
Re appr unit 15
Re   appr unit 15Re   appr unit 15
Re appr unit 15
 
Introduction to Probability
Introduction to ProbabilityIntroduction to Probability
Introduction to Probability
 
Discreet and continuous probability
Discreet and continuous probabilityDiscreet and continuous probability
Discreet and continuous probability
 
Probability concepts for Data Analytics
Probability concepts for Data AnalyticsProbability concepts for Data Analytics
Probability concepts for Data Analytics
 
Continous random variable.
Continous random variable.Continous random variable.
Continous random variable.
 
Sample Space and Event,Probability,The Axioms of Probability,Bayes Theorem
Sample Space and Event,Probability,The Axioms of Probability,Bayes TheoremSample Space and Event,Probability,The Axioms of Probability,Bayes Theorem
Sample Space and Event,Probability,The Axioms of Probability,Bayes Theorem
 
Heteroskedasticity
HeteroskedasticityHeteroskedasticity
Heteroskedasticity
 
Binomial probability distributions
Binomial probability distributions  Binomial probability distributions
Binomial probability distributions
 
Chapter 1 random variables and probability distributions
Chapter 1   random variables and probability distributionsChapter 1   random variables and probability distributions
Chapter 1 random variables and probability distributions
 
Probability 2(final)
Probability 2(final)Probability 2(final)
Probability 2(final)
 
Rational functions
Rational functionsRational functions
Rational functions
 
02 Machine Learning - Introduction probability
02 Machine Learning - Introduction probability02 Machine Learning - Introduction probability
02 Machine Learning - Introduction probability
 
binomial distribution
binomial distributionbinomial distribution
binomial distribution
 
Discrete probability distribution (complete)
Discrete probability distribution (complete)Discrete probability distribution (complete)
Discrete probability distribution (complete)
 
Probability class 9 ____ CBSE
Probability class 9 ____ CBSEProbability class 9 ____ CBSE
Probability class 9 ____ CBSE
 
Probability distributions
Probability distributions  Probability distributions
Probability distributions
 
Binomial distribution
Binomial distributionBinomial distribution
Binomial distribution
 
Basic probability theory and statistics
Basic probability theory and statisticsBasic probability theory and statistics
Basic probability theory and statistics
 

Destaque

Dignity presentation
Dignity presentationDignity presentation
Dignity presentationLili Coleman
 
Presentation%203
Presentation%203Presentation%203
Presentation%203Sanusia1
 
دعوة الشباب العصرية للإسلام
دعوة الشباب العصرية للإسلامدعوة الشباب العصرية للإسلام
دعوة الشباب العصرية للإسلامHassan Elagouz
 
إشراقات الإسراء ج1 للشيخ فوزي محمد أبوزيد
إشراقات الإسراء ج1 للشيخ فوزي محمد أبوزيدإشراقات الإسراء ج1 للشيخ فوزي محمد أبوزيد
إشراقات الإسراء ج1 للشيخ فوزي محمد أبوزيدHassan Elagouz
 
tabel comparativ lg contab
tabel comparativ lg contabtabel comparativ lg contab
tabel comparativ lg contabLaurentiu Marius
 
Lecture 3-cs648
Lecture 3-cs648Lecture 3-cs648
Lecture 3-cs648Rajiv Omar
 
كيف يحبك الله
كيف يحبك اللهكيف يحبك الله
كيف يحبك اللهHassan Elagouz
 
كتاب الكمالات المحمدية
كتاب الكمالات المحمديةكتاب الكمالات المحمدية
كتاب الكمالات المحمديةHassan Elagouz
 
ثانى اثنين لفضيلة الشيخ فوزى محمد أبوزيد
 ثانى اثنين لفضيلة الشيخ فوزى محمد أبوزيد  ثانى اثنين لفضيلة الشيخ فوزى محمد أبوزيد
ثانى اثنين لفضيلة الشيخ فوزى محمد أبوزيد Hassan Elagouz
 
Material informativ scaderea cotei de tva
Material informativ  scaderea cotei de tvaMaterial informativ  scaderea cotei de tva
Material informativ scaderea cotei de tvaLaurentiu Marius
 
North American Precambrian Craton Part A
North American Precambrian Craton Part ANorth American Precambrian Craton Part A
North American Precambrian Craton Part AWilliam Szary
 
Q1 evaluation (Pooja)
Q1 evaluation (Pooja)Q1 evaluation (Pooja)
Q1 evaluation (Pooja)GroupFiveMV
 

Destaque (20)

Dignity presentation
Dignity presentationDignity presentation
Dignity presentation
 
Shabang
ShabangShabang
Shabang
 
Tabel accize
Tabel accizeTabel accize
Tabel accize
 
Presentation%203
Presentation%203Presentation%203
Presentation%203
 
دعوة الشباب العصرية للإسلام
دعوة الشباب العصرية للإسلامدعوة الشباب العصرية للإسلام
دعوة الشباب العصرية للإسلام
 
Strategic Networking for Oil & Gas Professionals
Strategic Networking for Oil & Gas ProfessionalsStrategic Networking for Oil & Gas Professionals
Strategic Networking for Oil & Gas Professionals
 
إشراقات الإسراء ج1 للشيخ فوزي محمد أبوزيد
إشراقات الإسراء ج1 للشيخ فوزي محمد أبوزيدإشراقات الإسراء ج1 للشيخ فوزي محمد أبوزيد
إشراقات الإسراء ج1 للشيخ فوزي محمد أبوزيد
 
Q4 - Jemima Chamberlin
Q4 - Jemima ChamberlinQ4 - Jemima Chamberlin
Q4 - Jemima Chamberlin
 
Tabel - modif. CPP
Tabel - modif. CPPTabel - modif. CPP
Tabel - modif. CPP
 
tabel comparativ lg contab
tabel comparativ lg contabtabel comparativ lg contab
tabel comparativ lg contab
 
Lecture 3-cs648
Lecture 3-cs648Lecture 3-cs648
Lecture 3-cs648
 
Accize
AccizeAccize
Accize
 
Ghid ANAF
Ghid ANAFGhid ANAF
Ghid ANAF
 
كيف يحبك الله
كيف يحبك اللهكيف يحبك الله
كيف يحبك الله
 
كتاب الكمالات المحمدية
كتاب الكمالات المحمديةكتاب الكمالات المحمدية
كتاب الكمالات المحمدية
 
Panic Cord
Panic CordPanic Cord
Panic Cord
 
ثانى اثنين لفضيلة الشيخ فوزى محمد أبوزيد
 ثانى اثنين لفضيلة الشيخ فوزى محمد أبوزيد  ثانى اثنين لفضيلة الشيخ فوزى محمد أبوزيد
ثانى اثنين لفضيلة الشيخ فوزى محمد أبوزيد
 
Material informativ scaderea cotei de tva
Material informativ  scaderea cotei de tvaMaterial informativ  scaderea cotei de tva
Material informativ scaderea cotei de tva
 
North American Precambrian Craton Part A
North American Precambrian Craton Part ANorth American Precambrian Craton Part A
North American Precambrian Craton Part A
 
Q1 evaluation (Pooja)
Q1 evaluation (Pooja)Q1 evaluation (Pooja)
Q1 evaluation (Pooja)
 

Semelhante a Lecture 2-cs648

Topic 1 __basic_probability_concepts
Topic 1 __basic_probability_conceptsTopic 1 __basic_probability_concepts
Topic 1 __basic_probability_conceptsMaleakhi Agung Wijaya
 
powerpoints probability.pptx
powerpoints probability.pptxpowerpoints probability.pptx
powerpoints probability.pptxcarrie mixto
 
Probability theory discrete probability distribution
Probability theory discrete probability distributionProbability theory discrete probability distribution
Probability theory discrete probability distributionsamarthpawar9890
 
chapter five.pptx
chapter five.pptxchapter five.pptx
chapter five.pptxAbebeNega
 
Advanced Econometrics L5-6.pptx
Advanced Econometrics L5-6.pptxAdvanced Econometrics L5-6.pptx
Advanced Econometrics L5-6.pptxakashayosha
 
1 - Probabilty Introduction .ppt
1 - Probabilty Introduction .ppt1 - Probabilty Introduction .ppt
1 - Probabilty Introduction .pptVivek Bhartiya
 
PRML Chapter 1
PRML Chapter 1PRML Chapter 1
PRML Chapter 1Sunwoo Kim
 
Discrete Probability Distributions
Discrete Probability DistributionsDiscrete Probability Distributions
Discrete Probability Distributionsmandalina landy
 
Iteration method-Solution of algebraic and Transcendental Equations.
Iteration method-Solution of algebraic and Transcendental Equations.Iteration method-Solution of algebraic and Transcendental Equations.
Iteration method-Solution of algebraic and Transcendental Equations.AmitKumar8151
 
1.3.2 Inductive and Deductive Reasoning
1.3.2 Inductive and Deductive Reasoning1.3.2 Inductive and Deductive Reasoning
1.3.2 Inductive and Deductive Reasoningsmiller5
 
C2 st lecture 13 revision for test b handout
C2 st lecture 13   revision for test b handoutC2 st lecture 13   revision for test b handout
C2 st lecture 13 revision for test b handoutfatima d
 
Chapter Five.ppthhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Chapter Five.ppthhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhChapter Five.ppthhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Chapter Five.ppthhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhbeshahashenafe20
 

Semelhante a Lecture 2-cs648 (20)

Probability
ProbabilityProbability
Probability
 
Stat.pptx
Stat.pptxStat.pptx
Stat.pptx
 
Topic 1 __basic_probability_concepts
Topic 1 __basic_probability_conceptsTopic 1 __basic_probability_concepts
Topic 1 __basic_probability_concepts
 
powerpoints probability.pptx
powerpoints probability.pptxpowerpoints probability.pptx
powerpoints probability.pptx
 
Probability theory discrete probability distribution
Probability theory discrete probability distributionProbability theory discrete probability distribution
Probability theory discrete probability distribution
 
chapter five.pptx
chapter five.pptxchapter five.pptx
chapter five.pptx
 
Advanced Econometrics L5-6.pptx
Advanced Econometrics L5-6.pptxAdvanced Econometrics L5-6.pptx
Advanced Econometrics L5-6.pptx
 
Probability
ProbabilityProbability
Probability
 
1 - Probabilty Introduction .ppt
1 - Probabilty Introduction .ppt1 - Probabilty Introduction .ppt
1 - Probabilty Introduction .ppt
 
Chapter7ppt.pdf
Chapter7ppt.pdfChapter7ppt.pdf
Chapter7ppt.pdf
 
Probability and Statistics - Week 1
Probability and Statistics - Week 1Probability and Statistics - Week 1
Probability and Statistics - Week 1
 
PRML Chapter 1
PRML Chapter 1PRML Chapter 1
PRML Chapter 1
 
Discrete Probability Distributions
Discrete Probability DistributionsDiscrete Probability Distributions
Discrete Probability Distributions
 
Probability Distribution
Probability DistributionProbability Distribution
Probability Distribution
 
Iteration method-Solution of algebraic and Transcendental Equations.
Iteration method-Solution of algebraic and Transcendental Equations.Iteration method-Solution of algebraic and Transcendental Equations.
Iteration method-Solution of algebraic and Transcendental Equations.
 
1.3.2 Inductive and Deductive Reasoning
1.3.2 Inductive and Deductive Reasoning1.3.2 Inductive and Deductive Reasoning
1.3.2 Inductive and Deductive Reasoning
 
03 notes
03 notes03 notes
03 notes
 
C2 st lecture 13 revision for test b handout
C2 st lecture 13   revision for test b handoutC2 st lecture 13   revision for test b handout
C2 st lecture 13 revision for test b handout
 
Math quarter 2 module 8
Math quarter 2   module 8Math quarter 2   module 8
Math quarter 2 module 8
 
Chapter Five.ppthhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Chapter Five.ppthhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhChapter Five.ppthhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Chapter Five.ppthhjhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
 

Mais de Rajiv Omar

Lecture 6-cs345-2014
Lecture 6-cs345-2014Lecture 6-cs345-2014
Lecture 6-cs345-2014Rajiv Omar
 
Lecture 7-cs345-2014
Lecture 7-cs345-2014Lecture 7-cs345-2014
Lecture 7-cs345-2014Rajiv Omar
 
Lecture 14-2013
Lecture 14-2013Lecture 14-2013
Lecture 14-2013Rajiv Omar
 
Lecture 13-cs648
Lecture 13-cs648Lecture 13-cs648
Lecture 13-cs648Rajiv Omar
 
Lecture 14-cs648-2013
Lecture 14-cs648-2013Lecture 14-cs648-2013
Lecture 14-cs648-2013Rajiv Omar
 
Lecture 17-cs648
Lecture 17-cs648Lecture 17-cs648
Lecture 17-cs648Rajiv Omar
 
Lecture 18-cs648
Lecture 18-cs648Lecture 18-cs648
Lecture 18-cs648Rajiv Omar
 
Lecture 19-cs648
Lecture 19-cs648Lecture 19-cs648
Lecture 19-cs648Rajiv Omar
 
Lecture 20-cs648
Lecture 20-cs648Lecture 20-cs648
Lecture 20-cs648Rajiv Omar
 
Lecture 22-cs648
Lecture 22-cs648Lecture 22-cs648
Lecture 22-cs648Rajiv Omar
 
Lecture 4-cs648
Lecture 4-cs648Lecture 4-cs648
Lecture 4-cs648Rajiv Omar
 
Lecture 5-cs648
Lecture 5-cs648Lecture 5-cs648
Lecture 5-cs648Rajiv Omar
 
Lecture 6-cs648
Lecture 6-cs648Lecture 6-cs648
Lecture 6-cs648Rajiv Omar
 
Lecture 7-cs648
Lecture 7-cs648Lecture 7-cs648
Lecture 7-cs648Rajiv Omar
 
Lecture 8-cs648-2013
Lecture 8-cs648-2013Lecture 8-cs648-2013
Lecture 8-cs648-2013Rajiv Omar
 
Lecture 9-cs648-2013
Lecture 9-cs648-2013Lecture 9-cs648-2013
Lecture 9-cs648-2013Rajiv Omar
 
Lecture 1-cs648
Lecture 1-cs648Lecture 1-cs648
Lecture 1-cs648Rajiv Omar
 
Lecture 10-cs648=2013
Lecture 10-cs648=2013Lecture 10-cs648=2013
Lecture 10-cs648=2013Rajiv Omar
 

Mais de Rajiv Omar (20)

Lecture 6-cs345-2014
Lecture 6-cs345-2014Lecture 6-cs345-2014
Lecture 6-cs345-2014
 
Lecture 7-cs345-2014
Lecture 7-cs345-2014Lecture 7-cs345-2014
Lecture 7-cs345-2014
 
Lecture 14-2013
Lecture 14-2013Lecture 14-2013
Lecture 14-2013
 
Lecture 15
Lecture 15Lecture 15
Lecture 15
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
 
Lecture 13-cs648
Lecture 13-cs648Lecture 13-cs648
Lecture 13-cs648
 
Lecture 14-cs648-2013
Lecture 14-cs648-2013Lecture 14-cs648-2013
Lecture 14-cs648-2013
 
Lecture 17-cs648
Lecture 17-cs648Lecture 17-cs648
Lecture 17-cs648
 
Lecture 18-cs648
Lecture 18-cs648Lecture 18-cs648
Lecture 18-cs648
 
Lecture 19-cs648
Lecture 19-cs648Lecture 19-cs648
Lecture 19-cs648
 
Lecture 20-cs648
Lecture 20-cs648Lecture 20-cs648
Lecture 20-cs648
 
Lecture 22-cs648
Lecture 22-cs648Lecture 22-cs648
Lecture 22-cs648
 
Lecture 4-cs648
Lecture 4-cs648Lecture 4-cs648
Lecture 4-cs648
 
Lecture 5-cs648
Lecture 5-cs648Lecture 5-cs648
Lecture 5-cs648
 
Lecture 6-cs648
Lecture 6-cs648Lecture 6-cs648
Lecture 6-cs648
 
Lecture 7-cs648
Lecture 7-cs648Lecture 7-cs648
Lecture 7-cs648
 
Lecture 8-cs648-2013
Lecture 8-cs648-2013Lecture 8-cs648-2013
Lecture 8-cs648-2013
 
Lecture 9-cs648-2013
Lecture 9-cs648-2013Lecture 9-cs648-2013
Lecture 9-cs648-2013
 
Lecture 1-cs648
Lecture 1-cs648Lecture 1-cs648
Lecture 1-cs648
 
Lecture 10-cs648=2013
Lecture 10-cs648=2013Lecture 10-cs648=2013
Lecture 10-cs648=2013
 

Último

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Último (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Lecture 2-cs648

  • 1. Randomized Algorithms CS648 Lecture 2 • Randomized Algorithm for Approximate Median • Elementary Probability theory 1
  • 2. RANDOMIZED MONTE CARLO ALGORITHM FOR APPROXIMATE MEDIAN This lecture was delivered at slow pace and its flavor was that of a tutorial. Reason: To show that designing and analyzing a randomized algorithm demands right insight and just elementary probability. 2
  • 3. A simple probability exercise 3
  • 4. 4
  • 5. Approximate median Definition: Given an array A[] storing n numbers and ϵ > 0, compute an element whose rank is in the range [(1- ϵ)n/2, (1+ ϵ)n/2]. Best Deterministic Algorithm: • “Median of Medians” algorithm for finding exact median • Running time: O(n) • No faster algorithm possible for approximate median Can you give a short proof ? 5
  • 6. ½ - Approximate median A Randomized Algorithm Rand-Approx-Median(A) 1. Let k  c log n; 2. S  ∅; 3. For i=1 to k 4. x  an element selected randomly uniformly from A; 5. S  S U {x}; 6. Sort S. 7. Report the median of S. Running time: O(log n loglog n) 6
  • 7. Analyzing the error probability of Rand-approx-median n/4 Left Quarter Elements of A arranged in Increasing order of values 3n/4 Right Quarter When does the algorithm err ? To answer this question, try to characterize what will be a bad sample S ? 7
  • 8. Analyzing the error probability of Rand-approx-median n/4 Elements of A arranged in Increasing order of values Left Quarter 3n/4 Median of S Right Quarter Observation: Algorithm makes an error only if k/2 or more elements sampled from the Right Quarter (or Left Quarter). 8
  • 9. Analyzing the error probability of Rand-approx-median n/4 Elements of A arranged in Increasing order of values 3n/4 Right Quarter Left Quarter ¼ Exactly the same as the coin tossing exercise we did ! 9
  • 10. Main result we discussed 10
  • 11. ELEMENTARY PROBABILITY THEORY (IT IS SO SIMPLE THAT YOU UNDERESTIMATE ITS ELEGANCE AND POWER) 11
  • 12. Elementary probability theory (Relevant for CS648) • We shall mainly deal with discrete probability theory in this course. • We shall take the set theoretic approach to explain probability theory. Consider any random experiment : o Tossing a coin 5 times. o Throwing a dice 2 times. o Selecting a number randomly uniformly from [1..n]. How to capture the following facts in the theory of probability ? 1. Outcome will always be from a specified set. 2. Likelihood of each possible outcome is non-negative. 3. We may be interested in a collection of outcomes. 12
  • 14. Event in a Probability Space A Ω 14
  • 15. Exercises A randomized algorithm can also be viewed as a random experiment. 1. What is the sample space associated with Randomized Quick sort ? 2. What is the sample space associated with Rand-approx-median algorithm ? 15
  • 16. An Important Advice In the following slides, we shall state well known equations (highlighted in yellow boxes) from probability theory. • You should internalize them fully. • We shall use them crucially in this course. • Make sincere attempts to solve exercises that follow. 16
  • 17. Union of two Events A B Ω 17
  • 18. Union of three Events A B C Ω 18
  • 21. Exercises • A man possesses five coins, two of which are double-headed, one is double-tailed, and two are normal. He shuts his eyes, picks a coin at random, and tosses it. What is the probability that the lower face of the coin is a head ? He opens his eyes and sees that the coin is showing heads; what it the probability that the lower face is a head ? He shuts his eyes again, and tosses the coin again. What is the probability that the lower face is a head ? He opens his eyes and sees that the coin is showing heads; what is the probability that the lower face is a head ? He discards this coin, picks another at random, and tosses it. What is the probability that it shows heads ? 21
  • 22. Partition of sample space and an “important Equation” B Ω 22
  • 24. Independent Events P(A ∩ B) = P(A) · P(B) 24