SlideShare a Scribd company logo
Randomized Algorithms
CS648

Lecture 10
Random Sampling
part-II
(To find a subset with desired property)
1
Overview
•
•
•
•

There is a huge list (1 million) of blood donors.
Unfortunately the blood group information is missing at present.
We need a donor with blood group O+.
What to do ?

Solution: (Select a random subset of donors.)
Repeat until we get a donor of blood group O+.
{ Pick phone number of a donor randomly uniformly
Call him to ask his Blood group.
}
Random Sampling

• Suppose there is a computational problem where we require to find a
subset with some desired properties.
• Unfortunately, computing such a set deterministically may take huge time.
• Random sampling carried out suitably may produce a subset with the
desired property with some probability.
RANDOMIZED ALGORITHM FOR
BPWM PROBLEM
Integer Product of Matrices
1

0

0

1

0

1

0

1

0

0

2

1

2

0

0

1

0

0

0

1

0

1

1

0

1

2

0

1

0

0

0

0

1

0

0

1

1

1

1

0

1

1

1

1

0

0

1

0

1

0

1

1

1

0

0

1

2

2

0

1

1

1

0

1

0

1

0

0

1

0

2

2

3 0
D

1

A

B
Boolean Product of Matrices
1

0

0

1

0

1

0

1

0

0

1

1

1

0

0

1

0

0

0

1

0

1

1

0

1

1

0

1

0

0

0

0

1

0

0

1

1

1

1

0

1

1

1

1

0

0

1

0

1

0

1

1

1

0

0

1

1

1

0

1

1

1

0

1

0

1

0

0

1

0

1

1

1
C

0

1

A

B
Boolean Product of Matrices
1

0

0

1

0

1

0

1

0

0

1

1

1

0

0

1

0

0

0

1

0

1

1

0

1

1

0

1

0

0

0

0

1

0

0

1

1

1

1

0

1

1

1

1

0

0

1

0

1

0

1

1

1

0

0

1

1

1

0

1

1

1

0

1

0

1

0

0

1

0

1

1

1
C

0

1

A

B
Boolean Product Witness Matrix (BPWM)
MOTIVATION FOR BPWM
All Pairs Shortest Paths (APSP)
All Pairs Shortest Paths (APSP)
Students having interest in algorithms are
strongly advised to study this novel
algorithm from Motwani-Raghwan book
or the original journal version. (This is, of
course, not part of the syllabus for CS648)
RANDOMIZED ALGORITHM FOR
BPWM
Boolean Product Witness Matrix (BPWM)
Boolean Product of Matrices
1

0

0

1

0

1

0

1

0

0

1

1

1

0

0

1

0

0

0

1

0

1

1

0

1

1

0

1

0

0

0

0

1

0

0

1

1

1

1

0

1

1

1

1

0

0

1

0

1

0

1

1

1

0

0

1

1

1

0

1

1

1

0

1

0

1

0

0

1

0

1

1

1
C

0

1

2

1

2

0

0

2

0

1

0

0

1

1

1

1

0

1

2

2

0

1

2

2

3

0

1

A
Look carefully at the integer
product matrix D. Does it
have any thing to do with
witnesses.

B

D
Boolean Product of Matrices
1

0

0

1

0

1

0

1

0

0

2

1

2

0

0

1

0

0

0

1

0

1

1

0

1

2

0

1

0

0

0

0

1

0

0

1

1

1

1

0

1

1

1

1

0

0

1

0

1

0

1

1

1

0

0

1

2

2

0

1

1

1

0

1

0

1

0

0

1

0

2

2

3 0
D

1

A

B
Boolean Product of Matrices
1 2 3 4 5
⨯ ⨯ ⨯ ⨯ ⨯
1

0

0

1

0

1

0

1

0

0

2

1

2

0

0

1

0

0

0

1

0

1

1

0

1

2

0

1

0

0

0

0

1

0

0

1

1

1

1

0

1

1

1

1

0

0

1

0

1

0

1

1

1

0

0

1

2

2

0

1

1

1

0

1

0

1

0

0

1

0

2

2

3 0
D

1

A
There is a way to manipulate A so
that D will store a witness for all
those pairs which have singleton
witness. Can you guess ?

B
Boolean Product of Matrices
1 2 3 4 5
⨯ ⨯ ⨯ ⨯ ⨯
1

0

0

1

0

1

0

1

0

0

2

4

2

0

0

1

0

0

0

1

0

1

1

0

1

2

0

1

0

0

0

0

1

0

0

1

1

1

1

0

3

3

3

3

0

0

1

0

1

0

1

1

1

0

0

2

2

2

0

2

1

1

0

1

0

1

0

0

1

0

2

2

3 0
D

2

A

B
Boolean Product of Matrices
1 2 3 4 5
⨯ ⨯ ⨯ ⨯ ⨯
1

0

0

1

0

1

0

1

0

0

5

4

5

0

0

1

0

0

0

1

0

1

1

0

1

6

0

1

0

0

0

0

1

0

0

1

1

1

1

0

3

3

3

3

0

0

1

0

1

0

1

1

1

0

0

2

6

6

0

2

1

1

0

1

0

1

0

0

1

0

5

6

7 0
D

2

A

B
Algorithm for Computing Singleton Witnesses
Algorithm Design for BPWM
Lecture 10-cs648=2013
1 2 3 4

…

n

⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯
1
1
0
1
1

0

1

1

1

0

0

1

0

1

1

0
1
1
0
0

A

B
1 2 3 4

…

n

⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯
1
1
0
1
1

0

1

1

1

0

0

1

0

1

1

0
1
1
0
0

A

B
1 2 3 4 5

…

n-1 n

⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯
1
1
0
1
1

0

1

1

1

0

0

1

0

1

1

0
1
1
0
0

A

B
0 2 3 0 5

…

n-1 0

⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯
1
1
0
1
1

0

1

1

1

0

0

1

0

1

1

0
1
1
0
0

A

B
No idea!
Let us ask the following related but easier
question.
Lecture 10-cs648=2013
Lecture 10-cs648=2013
Lecture 10-cs648=2013
Lecture 10-cs648=2013
Lecture 10-cs648=2013
Conclusion

A sketch of the solution for Question 1 was given in the class. The
students are encouraged to work out the exact details. The solution
will be presented in the beginning of next lecture class.

More Related Content

PDF
جامع الأذكار والأوراد
PPT
Q1 evaluation (Pooja)
PDF
Республика Цвета - портфолио 2010 г
PDF
Anunt sit fin
DOCX
Daily activities-exercises
DOCX
Clothes
DOC
الأشفية النبوية للعصر لفضيلة الشيخ / فوزى محمد أبوزيد
PPTX
Ruba chocolate
جامع الأذكار والأوراد
Q1 evaluation (Pooja)
Республика Цвета - портфолио 2010 г
Anunt sit fin
Daily activities-exercises
Clothes
الأشفية النبوية للعصر لفضيلة الشيخ / فوزى محمد أبوزيد
Ruba chocolate

Viewers also liked (18)

PPSX
โครงงานคอมพิวเตอร์
PDF
be quran walking among people
PDF
Convenio de colaboracion para la ejecucion del programa de reforestacion en ...
PDF
رسالة الصالحين للشيخ فوزى محمد أبوزيد
PPTX
Prezi -bulldogs
DOC
Proposal ptk
PPTX
Presentation1
PDF
Micai13 turdus migratorius (2)
PDF
نوافل المقربين
PDF
Ghid util
PDF
الولاية والأولياء لفضيلة الشيخ فوزى محمد أبوزيد
PDF
Biodiesel no Brasil
PDF
كيف تكون داعيا إلى الله على بصيرة
PDF
Tabel accize oug 8
PDF
Physics 1
PPTX
Social media project
PPT
Handbag hangers-wholesale
PDF
الصيام شريعة وحقيقة للشيخ فوزي محمد أبوزيد
โครงงานคอมพิวเตอร์
be quran walking among people
Convenio de colaboracion para la ejecucion del programa de reforestacion en ...
رسالة الصالحين للشيخ فوزى محمد أبوزيد
Prezi -bulldogs
Proposal ptk
Presentation1
Micai13 turdus migratorius (2)
نوافل المقربين
Ghid util
الولاية والأولياء لفضيلة الشيخ فوزى محمد أبوزيد
Biodiesel no Brasil
كيف تكون داعيا إلى الله على بصيرة
Tabel accize oug 8
Physics 1
Social media project
Handbag hangers-wholesale
الصيام شريعة وحقيقة للشيخ فوزي محمد أبوزيد
Ad

Similar to Lecture 10-cs648=2013 (20)

PPTX
Lecture 10-cs648=2013 Randomized Algorithms
PPTX
Lecture 6-cs648
PPTX
Lecture 6-cs648 Randomized Algorithms
PPT
Randomized algorithms ver 1.0
PDF
Lesson 29
PDF
AI Lesson 29
PPTX
Overview of Approximation and Randomized Algorithms KARAN 461.pptx
PPTX
Algorithms Design
PPT
4900514.ppt
PPTX
chapter 3.pptx
PDF
Tutorial on Belief Propagation in Bayesian Networks
PPTX
Lecture 1-cs648
PDF
matlab functions
PPTX
Lecture 1-cs648
PPT
random test
PDF
More on randomization semi-definite programming and derandomization
PPTX
cs 601 - lecture 1.pptx
PDF
03. dynamic programming
PDF
MASSS_Presentation_20160209
PDF
Data Analysis and Programming in R
Lecture 10-cs648=2013 Randomized Algorithms
Lecture 6-cs648
Lecture 6-cs648 Randomized Algorithms
Randomized algorithms ver 1.0
Lesson 29
AI Lesson 29
Overview of Approximation and Randomized Algorithms KARAN 461.pptx
Algorithms Design
4900514.ppt
chapter 3.pptx
Tutorial on Belief Propagation in Bayesian Networks
Lecture 1-cs648
matlab functions
Lecture 1-cs648
random test
More on randomization semi-definite programming and derandomization
cs 601 - lecture 1.pptx
03. dynamic programming
MASSS_Presentation_20160209
Data Analysis and Programming in R
Ad

More from Rajiv Omar (20)

PPTX
Lecture 6-cs345-2014
PPTX
Lecture 7-cs345-2014
PPTX
Lecture 14-2013
ODP
Lecture 2-cs648
PPTX
Lecture 15
PPTX
Lecture 16
PPTX
Lecture 13-cs648
PPTX
Lecture 14-cs648-2013
PPTX
Lecture 17-cs648
PPTX
Lecture 18-cs648
PPTX
Lecture 19-cs648
PPTX
Lecture 20-cs648
PPTX
Lecture 22-cs648
PPTX
Lecture 3-cs648
PPTX
Lecture 4-cs648
PPTX
Lecture 5-cs648
PPTX
Lecture 7-cs648
PPTX
Lecture 8-cs648-2013
PPTX
Lecture 9-cs648-2013
PPTX
Lecture 11-cs648-2013
Lecture 6-cs345-2014
Lecture 7-cs345-2014
Lecture 14-2013
Lecture 2-cs648
Lecture 15
Lecture 16
Lecture 13-cs648
Lecture 14-cs648-2013
Lecture 17-cs648
Lecture 18-cs648
Lecture 19-cs648
Lecture 20-cs648
Lecture 22-cs648
Lecture 3-cs648
Lecture 4-cs648
Lecture 5-cs648
Lecture 7-cs648
Lecture 8-cs648-2013
Lecture 9-cs648-2013
Lecture 11-cs648-2013

Recently uploaded (20)

PDF
MSPs in 10 Words - Created by US MSP Network
PDF
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
PDF
BsN 7th Sem Course GridNNNNNNNN CCN.pdf
PDF
How to Get Funding for Your Trucking Business
PPT
Data mining for business intelligence ch04 sharda
PDF
20250805_A. Stotz All Weather Strategy - Performance review July 2025.pdf
PPTX
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
PDF
Reconciliation AND MEMORANDUM RECONCILATION
PPT
340036916-American-Literature-Literary-Period-Overview.ppt
PDF
Chapter 5_Foreign Exchange Market in .pdf
PDF
Roadmap Map-digital Banking feature MB,IB,AB
PDF
How to Get Business Funding for Small Business Fast
PPTX
5 Stages of group development guide.pptx
PPTX
Principles of Marketing, Industrial, Consumers,
PDF
SIMNET Inc – 2023’s Most Trusted IT Services & Solution Provider
PDF
IFRS Notes in your pocket for study all the time
PPTX
Dragon_Fruit_Cultivation_in Nepal ppt.pptx
PPTX
ICG2025_ICG 6th steering committee 30-8-24.pptx
PDF
Business model innovation report 2022.pdf
PDF
Laughter Yoga Basic Learning Workshop Manual
MSPs in 10 Words - Created by US MSP Network
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
BsN 7th Sem Course GridNNNNNNNN CCN.pdf
How to Get Funding for Your Trucking Business
Data mining for business intelligence ch04 sharda
20250805_A. Stotz All Weather Strategy - Performance review July 2025.pdf
CkgxkgxydkydyldylydlydyldlyddolydyoyyU2.pptx
Reconciliation AND MEMORANDUM RECONCILATION
340036916-American-Literature-Literary-Period-Overview.ppt
Chapter 5_Foreign Exchange Market in .pdf
Roadmap Map-digital Banking feature MB,IB,AB
How to Get Business Funding for Small Business Fast
5 Stages of group development guide.pptx
Principles of Marketing, Industrial, Consumers,
SIMNET Inc – 2023’s Most Trusted IT Services & Solution Provider
IFRS Notes in your pocket for study all the time
Dragon_Fruit_Cultivation_in Nepal ppt.pptx
ICG2025_ICG 6th steering committee 30-8-24.pptx
Business model innovation report 2022.pdf
Laughter Yoga Basic Learning Workshop Manual

Lecture 10-cs648=2013

  • 1. Randomized Algorithms CS648 Lecture 10 Random Sampling part-II (To find a subset with desired property) 1
  • 2. Overview • • • • There is a huge list (1 million) of blood donors. Unfortunately the blood group information is missing at present. We need a donor with blood group O+. What to do ? Solution: (Select a random subset of donors.) Repeat until we get a donor of blood group O+. { Pick phone number of a donor randomly uniformly Call him to ask his Blood group. }
  • 3. Random Sampling • Suppose there is a computational problem where we require to find a subset with some desired properties. • Unfortunately, computing such a set deterministically may take huge time. • Random sampling carried out suitably may produce a subset with the desired property with some probability.
  • 5. Integer Product of Matrices 1 0 0 1 0 1 0 1 0 0 2 1 2 0 0 1 0 0 0 1 0 1 1 0 1 2 0 1 0 0 0 0 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 0 1 1 1 0 0 1 2 2 0 1 1 1 0 1 0 1 0 0 1 0 2 2 3 0 D 1 A B
  • 6. Boolean Product of Matrices 1 0 0 1 0 1 0 1 0 0 1 1 1 0 0 1 0 0 0 1 0 1 1 0 1 1 0 1 0 0 0 0 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 0 1 1 1 0 0 1 1 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 1 C 0 1 A B
  • 7. Boolean Product of Matrices 1 0 0 1 0 1 0 1 0 0 1 1 1 0 0 1 0 0 0 1 0 1 1 0 1 1 0 1 0 0 0 0 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 0 1 1 1 0 0 1 1 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 1 C 0 1 A B
  • 8. Boolean Product Witness Matrix (BPWM)
  • 10. All Pairs Shortest Paths (APSP)
  • 11. All Pairs Shortest Paths (APSP) Students having interest in algorithms are strongly advised to study this novel algorithm from Motwani-Raghwan book or the original journal version. (This is, of course, not part of the syllabus for CS648)
  • 13. Boolean Product Witness Matrix (BPWM)
  • 14. Boolean Product of Matrices 1 0 0 1 0 1 0 1 0 0 1 1 1 0 0 1 0 0 0 1 0 1 1 0 1 1 0 1 0 0 0 0 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 0 1 1 1 0 0 1 1 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 1 C 0 1 2 1 2 0 0 2 0 1 0 0 1 1 1 1 0 1 2 2 0 1 2 2 3 0 1 A Look carefully at the integer product matrix D. Does it have any thing to do with witnesses. B D
  • 15. Boolean Product of Matrices 1 0 0 1 0 1 0 1 0 0 2 1 2 0 0 1 0 0 0 1 0 1 1 0 1 2 0 1 0 0 0 0 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 0 1 1 1 0 0 1 2 2 0 1 1 1 0 1 0 1 0 0 1 0 2 2 3 0 D 1 A B
  • 16. Boolean Product of Matrices 1 2 3 4 5 ⨯ ⨯ ⨯ ⨯ ⨯ 1 0 0 1 0 1 0 1 0 0 2 1 2 0 0 1 0 0 0 1 0 1 1 0 1 2 0 1 0 0 0 0 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 0 1 1 1 0 0 1 2 2 0 1 1 1 0 1 0 1 0 0 1 0 2 2 3 0 D 1 A There is a way to manipulate A so that D will store a witness for all those pairs which have singleton witness. Can you guess ? B
  • 17. Boolean Product of Matrices 1 2 3 4 5 ⨯ ⨯ ⨯ ⨯ ⨯ 1 0 0 1 0 1 0 1 0 0 2 4 2 0 0 1 0 0 0 1 0 1 1 0 1 2 0 1 0 0 0 0 1 0 0 1 1 1 1 0 3 3 3 3 0 0 1 0 1 0 1 1 1 0 0 2 2 2 0 2 1 1 0 1 0 1 0 0 1 0 2 2 3 0 D 2 A B
  • 18. Boolean Product of Matrices 1 2 3 4 5 ⨯ ⨯ ⨯ ⨯ ⨯ 1 0 0 1 0 1 0 1 0 0 5 4 5 0 0 1 0 0 0 1 0 1 1 0 1 6 0 1 0 0 0 0 1 0 0 1 1 1 1 0 3 3 3 3 0 0 1 0 1 0 1 1 1 0 0 2 6 6 0 2 1 1 0 1 0 1 0 0 1 0 5 6 7 0 D 2 A B
  • 19. Algorithm for Computing Singleton Witnesses
  • 22. 1 2 3 4 … n ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ 1 1 0 1 1 0 1 1 1 0 0 1 0 1 1 0 1 1 0 0 A B
  • 23. 1 2 3 4 … n ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ 1 1 0 1 1 0 1 1 1 0 0 1 0 1 1 0 1 1 0 0 A B
  • 24. 1 2 3 4 5 … n-1 n ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ 1 1 0 1 1 0 1 1 1 0 0 1 0 1 1 0 1 1 0 0 A B
  • 25. 0 2 3 0 5 … n-1 0 ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ ⨯ 1 1 0 1 1 0 1 1 1 0 0 1 0 1 1 0 1 1 0 0 A B
  • 26. No idea! Let us ask the following related but easier question.
  • 32. Conclusion A sketch of the solution for Question 1 was given in the class. The students are encouraged to work out the exact details. The solution will be presented in the beginning of next lecture class.