SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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)
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty SecureFemke de Vroome
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeCzechDreamin
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...FIDO Alliance
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutesconfluent
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyUXDXConf
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024Stephen Perrenod
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxJennifer Lim
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 

Kürzlich hochgeladen (20)

ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 

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