SlideShare a Scribd company logo
CS 321. Algorithm Analysis & Design
Lecture 6
Divide and Conquer
Closest Pair
Input: A set of n points given in terms of (x,y) coordinates.
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
Input: A set of n points given in terms of (x) coordinates.
Output: The closest pair.
Compute distances
between all pairs.
Approach #0
O(n2)
Sort the points.
Sweep through adjacent pairs.
Approach 1
Time to sort + O(n)
Divide and Conquer.
Split the point set, use recursive solutions.
Approach 2
Cost of Recursion + Time to merge
Input: A set of n points given in terms of (x) coordinates.
Output: The closest pair.
Input: A set of n points given in terms of (x) coordinates.
Output: The closest pair.
Input: A set of n points given in terms of (x) coordinates.
Output: The closest pair.
Closest Pair on Left - d1
Closest Pair on Right - d2
Input: A set of n points given in terms of (x) coordinates.
Output: The closest pair.
Closest Pair on Left - d1
Closest Pair on Right - d2
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
1
2
3
4
5
6
7
8
9
10
11
12
13
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
13
1
7
5
3
9
8
11
10
4
12
2
6
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
d/2
d/2
Input: A set of n points given in terms of (x,y) coordinates.
Output: The closest pair.
d/2
d/2
T(n) ≤ 2T(n/2) + O(n)
T(n) = O(n log n)

More Related Content

What's hot

Quadraticapplications.ppt
Quadraticapplications.pptQuadraticapplications.ppt
Quadraticapplications.ppt
Department of Education
 
Math presentation on domain and range
Math presentation on domain and rangeMath presentation on domain and range
Math presentation on domain and range
Touhidul Shawan
 
Calculus
Calculus Calculus
Iterative1
Iterative1Iterative1
Iterative1
Md. Mujahid Islam
 
10.5 more on language of functions x
10.5 more on language of functions x10.5 more on language of functions x
10.5 more on language of functions x
math260
 
Polynomial functionsandgraphs
Polynomial functionsandgraphsPolynomial functionsandgraphs
Polynomial functionsandgraphs
Jerlyn Fernandez
 
Gre 403 jeopardy
Gre 403 jeopardyGre 403 jeopardy
Gre 403 jeopardy
jbassler33
 
9 the basic language of functions x
9 the basic language of functions x9 the basic language of functions x
9 the basic language of functions x
math260
 
2 1 polynomials
2 1 polynomials2 1 polynomials
2 1 polynomials
hisema01
 
7.2 abs value function
7.2 abs value function7.2 abs value function
7.2 abs value function
Michael Cellini
 
Module 3 polynomial functions
Module 3   polynomial functionsModule 3   polynomial functions
Module 3 polynomial functions
dionesioable
 
Produccion escrita expresiones algebraicas
Produccion escrita   expresiones algebraicasProduccion escrita   expresiones algebraicas
Produccion escrita expresiones algebraicas
JuinAndresDiaz
 
3.3 Zeros of Polynomial Functions
3.3 Zeros of Polynomial Functions3.3 Zeros of Polynomial Functions
3.3 Zeros of Polynomial Functions
smiller5
 
Polynomials Grade 10
Polynomials Grade 10Polynomials Grade 10
Polynomials Grade 10
ingroy
 
Algebraic functions powerpoint
Algebraic functions powerpointAlgebraic functions powerpoint
Algebraic functions powerpoint
Caron White
 
Application of derivative
Application of derivativeApplication of derivative
The Quadratic Function Derived From Zeros of the Equation (SNSD Theme)
The Quadratic Function Derived From Zeros of the Equation (SNSD Theme)The Quadratic Function Derived From Zeros of the Equation (SNSD Theme)
The Quadratic Function Derived From Zeros of the Equation (SNSD Theme)
SNSDTaeyeon
 
Ani agustina (a1 c011007) polynomial
Ani agustina (a1 c011007) polynomialAni agustina (a1 c011007) polynomial
Ani agustina (a1 c011007) polynomial
Ani_Agustina
 
Finding zeros of a quadratic function
Finding zeros of a quadratic functionFinding zeros of a quadratic function
Finding zeros of a quadratic function
Aaron James Lico
 

What's hot (19)

Quadraticapplications.ppt
Quadraticapplications.pptQuadraticapplications.ppt
Quadraticapplications.ppt
 
Math presentation on domain and range
Math presentation on domain and rangeMath presentation on domain and range
Math presentation on domain and range
 
Calculus
Calculus Calculus
Calculus
 
Iterative1
Iterative1Iterative1
Iterative1
 
10.5 more on language of functions x
10.5 more on language of functions x10.5 more on language of functions x
10.5 more on language of functions x
 
Polynomial functionsandgraphs
Polynomial functionsandgraphsPolynomial functionsandgraphs
Polynomial functionsandgraphs
 
Gre 403 jeopardy
Gre 403 jeopardyGre 403 jeopardy
Gre 403 jeopardy
 
9 the basic language of functions x
9 the basic language of functions x9 the basic language of functions x
9 the basic language of functions x
 
2 1 polynomials
2 1 polynomials2 1 polynomials
2 1 polynomials
 
7.2 abs value function
7.2 abs value function7.2 abs value function
7.2 abs value function
 
Module 3 polynomial functions
Module 3   polynomial functionsModule 3   polynomial functions
Module 3 polynomial functions
 
Produccion escrita expresiones algebraicas
Produccion escrita   expresiones algebraicasProduccion escrita   expresiones algebraicas
Produccion escrita expresiones algebraicas
 
3.3 Zeros of Polynomial Functions
3.3 Zeros of Polynomial Functions3.3 Zeros of Polynomial Functions
3.3 Zeros of Polynomial Functions
 
Polynomials Grade 10
Polynomials Grade 10Polynomials Grade 10
Polynomials Grade 10
 
Algebraic functions powerpoint
Algebraic functions powerpointAlgebraic functions powerpoint
Algebraic functions powerpoint
 
Application of derivative
Application of derivativeApplication of derivative
Application of derivative
 
The Quadratic Function Derived From Zeros of the Equation (SNSD Theme)
The Quadratic Function Derived From Zeros of the Equation (SNSD Theme)The Quadratic Function Derived From Zeros of the Equation (SNSD Theme)
The Quadratic Function Derived From Zeros of the Equation (SNSD Theme)
 
Ani agustina (a1 c011007) polynomial
Ani agustina (a1 c011007) polynomialAni agustina (a1 c011007) polynomial
Ani agustina (a1 c011007) polynomial
 
Finding zeros of a quadratic function
Finding zeros of a quadratic functionFinding zeros of a quadratic function
Finding zeros of a quadratic function
 

Similar to 06 - 20 Jan - Divide and Conquer

4.2,4.3 graphing
4.2,4.3 graphing4.2,4.3 graphing
4.2,4.3 graphing
vhiggins1
 
Jurnal informatika
Jurnal informatika Jurnal informatika
Jurnal informatika
MamaMa28
 
Java code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdfJava code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdf
fashioncollection2
 
ClosestPairClosestPairClosestPairClosestPair
ClosestPairClosestPairClosestPairClosestPairClosestPairClosestPairClosestPairClosestPair
ClosestPairClosestPairClosestPairClosestPair
Shanmuganathan C
 
Cost allocation in vertex weighted Steiner tree games
Cost allocation in vertex weighted Steiner tree gamesCost allocation in vertex weighted Steiner tree games
Cost allocation in vertex weighted Steiner tree games
vinnief
 
Polynomials
PolynomialsPolynomials
Polynomials
VivekNaithani3
 
Approximate Nearest Neighbour in Higher Dimensions
Approximate Nearest Neighbour in Higher DimensionsApproximate Nearest Neighbour in Higher Dimensions
Approximate Nearest Neighbour in Higher Dimensions
Shrey Verma
 
An algorithm for computing resultant polytopes
An algorithm for computing resultant polytopesAn algorithm for computing resultant polytopes
An algorithm for computing resultant polytopes
Vissarion Fisikopoulos
 
Nbhm m. a. and m.sc. scholarship test 2005
Nbhm m. a. and m.sc. scholarship test 2005Nbhm m. a. and m.sc. scholarship test 2005
Nbhm m. a. and m.sc. scholarship test 2005
MD Kutubuddin Sardar
 
factoring
factoringfactoring
factoring
Harish Sahu
 
Applied Math 40S June 2 AM, 2008
Applied Math 40S June 2 AM, 2008Applied Math 40S June 2 AM, 2008
Applied Math 40S June 2 AM, 2008
Darren Kuropatwa
 
Cs6402 design and analysis of algorithms may june 2016 answer key
Cs6402 design and analysis of algorithms may june 2016 answer keyCs6402 design and analysis of algorithms may june 2016 answer key
Cs6402 design and analysis of algorithms may june 2016 answer key
appasami
 
Algorithms
AlgorithmsAlgorithms
Algorithms
Ankit Agarwal
 
NUMERICAL METHODS
NUMERICAL METHODSNUMERICAL METHODS
NUMERICAL METHODS
PRABHAHARAN429
 
January 13, 2014
January 13, 2014January 13, 2014
January 13, 2014
khyps13
 
A Tutorial on Computational Geometry
A Tutorial on Computational GeometryA Tutorial on Computational Geometry
A Tutorial on Computational Geometry
Minh-Tri Pham
 
Polynomial Function and Synthetic Division
Polynomial Function and Synthetic DivisionPolynomial Function and Synthetic Division
Polynomial Function and Synthetic Division
AleczQ1414
 
Disjoint sets
Disjoint setsDisjoint sets
Disjoint sets
Core Condor
 
Imc2020 day1&2 problems&solutions
Imc2020 day1&2 problems&solutionsImc2020 day1&2 problems&solutions
Imc2020 day1&2 problems&solutions
Christos Loizos
 
Ch07 6
Ch07 6Ch07 6
Ch07 6
Rendy Robert
 

Similar to 06 - 20 Jan - Divide and Conquer (20)

4.2,4.3 graphing
4.2,4.3 graphing4.2,4.3 graphing
4.2,4.3 graphing
 
Jurnal informatika
Jurnal informatika Jurnal informatika
Jurnal informatika
 
Java code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdfJava code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdf
 
ClosestPairClosestPairClosestPairClosestPair
ClosestPairClosestPairClosestPairClosestPairClosestPairClosestPairClosestPairClosestPair
ClosestPairClosestPairClosestPairClosestPair
 
Cost allocation in vertex weighted Steiner tree games
Cost allocation in vertex weighted Steiner tree gamesCost allocation in vertex weighted Steiner tree games
Cost allocation in vertex weighted Steiner tree games
 
Polynomials
PolynomialsPolynomials
Polynomials
 
Approximate Nearest Neighbour in Higher Dimensions
Approximate Nearest Neighbour in Higher DimensionsApproximate Nearest Neighbour in Higher Dimensions
Approximate Nearest Neighbour in Higher Dimensions
 
An algorithm for computing resultant polytopes
An algorithm for computing resultant polytopesAn algorithm for computing resultant polytopes
An algorithm for computing resultant polytopes
 
Nbhm m. a. and m.sc. scholarship test 2005
Nbhm m. a. and m.sc. scholarship test 2005Nbhm m. a. and m.sc. scholarship test 2005
Nbhm m. a. and m.sc. scholarship test 2005
 
factoring
factoringfactoring
factoring
 
Applied Math 40S June 2 AM, 2008
Applied Math 40S June 2 AM, 2008Applied Math 40S June 2 AM, 2008
Applied Math 40S June 2 AM, 2008
 
Cs6402 design and analysis of algorithms may june 2016 answer key
Cs6402 design and analysis of algorithms may june 2016 answer keyCs6402 design and analysis of algorithms may june 2016 answer key
Cs6402 design and analysis of algorithms may june 2016 answer key
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
NUMERICAL METHODS
NUMERICAL METHODSNUMERICAL METHODS
NUMERICAL METHODS
 
January 13, 2014
January 13, 2014January 13, 2014
January 13, 2014
 
A Tutorial on Computational Geometry
A Tutorial on Computational GeometryA Tutorial on Computational Geometry
A Tutorial on Computational Geometry
 
Polynomial Function and Synthetic Division
Polynomial Function and Synthetic DivisionPolynomial Function and Synthetic Division
Polynomial Function and Synthetic Division
 
Disjoint sets
Disjoint setsDisjoint sets
Disjoint sets
 
Imc2020 day1&2 problems&solutions
Imc2020 day1&2 problems&solutionsImc2020 day1&2 problems&solutions
Imc2020 day1&2 problems&solutions
 
Ch07 6
Ch07 6Ch07 6
Ch07 6
 

More from Neeldhara Misra

Erdos Posa Theorem
Erdos Posa TheoremErdos Posa Theorem
Erdos Posa Theorem
Neeldhara Misra
 
15 - 12 Feb - Stable Matchings
15 - 12 Feb - Stable Matchings15 - 12 Feb - Stable Matchings
15 - 12 Feb - Stable Matchings
Neeldhara Misra
 
07- 22 Jan - Divide and Conquer
07- 22 Jan - Divide and Conquer07- 22 Jan - Divide and Conquer
07- 22 Jan - Divide and Conquer
Neeldhara Misra
 
10 - 29 Jan - Recursion Part 2
10 - 29 Jan - Recursion Part 210 - 29 Jan - Recursion Part 2
10 - 29 Jan - Recursion Part 2
Neeldhara Misra
 
05 - 18 Jan - The Sorting Wrap-Up
05 - 18 Jan - The Sorting Wrap-Up05 - 18 Jan - The Sorting Wrap-Up
05 - 18 Jan - The Sorting Wrap-Up
Neeldhara Misra
 
02 - 04 Jan - Sorting (Continued)
02 - 04 Jan - Sorting (Continued)02 - 04 Jan - Sorting (Continued)
02 - 04 Jan - Sorting (Continued)
Neeldhara Misra
 
04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort
Neeldhara Misra
 
08 - 25 Jan - Divide and Conquer
08 - 25 Jan - Divide and Conquer08 - 25 Jan - Divide and Conquer
08 - 25 Jan - Divide and Conquer
Neeldhara Misra
 
13 - 06 Feb - Dynamic Programming
13 - 06 Feb - Dynamic Programming13 - 06 Feb - Dynamic Programming
13 - 06 Feb - Dynamic Programming
Neeldhara Misra
 
00 - 30 Dec - Introduction
00 - 30 Dec - Introduction00 - 30 Dec - Introduction
00 - 30 Dec - Introduction
Neeldhara Misra
 
01 - 01 January - Sorting
01 - 01 January - Sorting01 - 01 January - Sorting
01 - 01 January - Sorting
Neeldhara Misra
 
14 - 08 Feb - Dynamic Programming
14 - 08 Feb - Dynamic Programming14 - 08 Feb - Dynamic Programming
14 - 08 Feb - Dynamic Programming
Neeldhara Misra
 
11 - 03 Feb - From Recursion to Dynamic Programming
11 - 03 Feb - From Recursion to Dynamic Programming11 - 03 Feb - From Recursion to Dynamic Programming
11 - 03 Feb - From Recursion to Dynamic Programming
Neeldhara Misra
 
09 - 27 Jan - Recursion Part 1
09 - 27 Jan - Recursion Part 109 - 27 Jan - Recursion Part 1
09 - 27 Jan - Recursion Part 1
Neeldhara Misra
 
04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort
Neeldhara Misra
 
12 - 05 Feb - Dynamic Programming
12 - 05 Feb - Dynamic Programming12 - 05 Feb - Dynamic Programming
12 - 05 Feb - Dynamic Programming
Neeldhara Misra
 

More from Neeldhara Misra (16)

Erdos Posa Theorem
Erdos Posa TheoremErdos Posa Theorem
Erdos Posa Theorem
 
15 - 12 Feb - Stable Matchings
15 - 12 Feb - Stable Matchings15 - 12 Feb - Stable Matchings
15 - 12 Feb - Stable Matchings
 
07- 22 Jan - Divide and Conquer
07- 22 Jan - Divide and Conquer07- 22 Jan - Divide and Conquer
07- 22 Jan - Divide and Conquer
 
10 - 29 Jan - Recursion Part 2
10 - 29 Jan - Recursion Part 210 - 29 Jan - Recursion Part 2
10 - 29 Jan - Recursion Part 2
 
05 - 18 Jan - The Sorting Wrap-Up
05 - 18 Jan - The Sorting Wrap-Up05 - 18 Jan - The Sorting Wrap-Up
05 - 18 Jan - The Sorting Wrap-Up
 
02 - 04 Jan - Sorting (Continued)
02 - 04 Jan - Sorting (Continued)02 - 04 Jan - Sorting (Continued)
02 - 04 Jan - Sorting (Continued)
 
04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort
 
08 - 25 Jan - Divide and Conquer
08 - 25 Jan - Divide and Conquer08 - 25 Jan - Divide and Conquer
08 - 25 Jan - Divide and Conquer
 
13 - 06 Feb - Dynamic Programming
13 - 06 Feb - Dynamic Programming13 - 06 Feb - Dynamic Programming
13 - 06 Feb - Dynamic Programming
 
00 - 30 Dec - Introduction
00 - 30 Dec - Introduction00 - 30 Dec - Introduction
00 - 30 Dec - Introduction
 
01 - 01 January - Sorting
01 - 01 January - Sorting01 - 01 January - Sorting
01 - 01 January - Sorting
 
14 - 08 Feb - Dynamic Programming
14 - 08 Feb - Dynamic Programming14 - 08 Feb - Dynamic Programming
14 - 08 Feb - Dynamic Programming
 
11 - 03 Feb - From Recursion to Dynamic Programming
11 - 03 Feb - From Recursion to Dynamic Programming11 - 03 Feb - From Recursion to Dynamic Programming
11 - 03 Feb - From Recursion to Dynamic Programming
 
09 - 27 Jan - Recursion Part 1
09 - 27 Jan - Recursion Part 109 - 27 Jan - Recursion Part 1
09 - 27 Jan - Recursion Part 1
 
04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort04 - 15 Jan - Heap Sort
04 - 15 Jan - Heap Sort
 
12 - 05 Feb - Dynamic Programming
12 - 05 Feb - Dynamic Programming12 - 05 Feb - Dynamic Programming
12 - 05 Feb - Dynamic Programming
 

Recently uploaded

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 

Recently uploaded (20)

How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 

06 - 20 Jan - Divide and Conquer

  • 1. CS 321. Algorithm Analysis & Design Lecture 6 Divide and Conquer
  • 3.
  • 4. Input: A set of n points given in terms of (x,y) coordinates.
  • 5. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair.
  • 6. Input: A set of n points given in terms of (x) coordinates. Output: The closest pair.
  • 7. Compute distances between all pairs. Approach #0 O(n2)
  • 8. Sort the points. Sweep through adjacent pairs. Approach 1 Time to sort + O(n)
  • 9. Divide and Conquer. Split the point set, use recursive solutions. Approach 2 Cost of Recursion + Time to merge
  • 10. Input: A set of n points given in terms of (x) coordinates. Output: The closest pair.
  • 11. Input: A set of n points given in terms of (x) coordinates. Output: The closest pair.
  • 12. Input: A set of n points given in terms of (x) coordinates. Output: The closest pair. Closest Pair on Left - d1 Closest Pair on Right - d2
  • 13. Input: A set of n points given in terms of (x) coordinates. Output: The closest pair. Closest Pair on Left - d1 Closest Pair on Right - d2
  • 14. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair.
  • 15. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair. 1 2 3 4 5 6 7 8 9 10 11 12 13
  • 16. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair.
  • 17. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair. 13 1 7 5 3 9 8 11 10 4 12 2 6
  • 18. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair.
  • 19. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair.
  • 20. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair.
  • 21. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair.
  • 22. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair.
  • 23. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair. d/2 d/2
  • 24. Input: A set of n points given in terms of (x,y) coordinates. Output: The closest pair. d/2 d/2
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. T(n) ≤ 2T(n/2) + O(n) T(n) = O(n log n)