SlideShare a Scribd company logo
1 of 32
Download to read offline
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

Math presentation on domain and range
Math presentation on domain and rangeMath presentation on domain and range
Math presentation on domain and rangeTouhidul Shawan
 
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 xmath260
 
Polynomial functionsandgraphs
Polynomial functionsandgraphsPolynomial functionsandgraphs
Polynomial functionsandgraphsJerlyn Fernandez
 
Gre 403 jeopardy
Gre 403 jeopardyGre 403 jeopardy
Gre 403 jeopardyjbassler33
 
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 xmath260
 
2 1 polynomials
2 1 polynomials2 1 polynomials
2 1 polynomialshisema01
 
Module 3 polynomial functions
Module 3   polynomial functionsModule 3   polynomial functions
Module 3 polynomial functionsdionesioable
 
Produccion escrita expresiones algebraicas
Produccion escrita   expresiones algebraicasProduccion escrita   expresiones algebraicas
Produccion escrita expresiones algebraicasJuinAndresDiaz
 
3.3 Zeros of Polynomial Functions
3.3 Zeros of Polynomial Functions3.3 Zeros of Polynomial Functions
3.3 Zeros of Polynomial Functionssmiller5
 
Polynomials Grade 10
Polynomials Grade 10Polynomials Grade 10
Polynomials Grade 10ingroy
 
Algebraic functions powerpoint
Algebraic functions powerpointAlgebraic functions powerpoint
Algebraic functions powerpointCaron White
 
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) polynomialAni_Agustina
 
Finding zeros of a quadratic function
Finding zeros of a quadratic functionFinding zeros of a quadratic function
Finding zeros of a quadratic functionAaron 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 graphingvhiggins1
 
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.pdffashioncollection2
 
ClosestPairClosestPairClosestPairClosestPair
ClosestPairClosestPairClosestPairClosestPairClosestPairClosestPairClosestPairClosestPair
ClosestPairClosestPairClosestPairClosestPairShanmuganathan 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 gamesvinnief
 
Approximate Nearest Neighbour in Higher Dimensions
Approximate Nearest Neighbour in Higher DimensionsApproximate Nearest Neighbour in Higher Dimensions
Approximate Nearest Neighbour in Higher DimensionsShrey Verma
 
An algorithm for computing resultant polytopes
An algorithm for computing resultant polytopesAn algorithm for computing resultant polytopes
An algorithm for computing resultant polytopesVissarion 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 2005MD Kutubuddin Sardar
 
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, 2008Darren 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 keyappasami
 
January 13, 2014
January 13, 2014January 13, 2014
January 13, 2014khyps13
 
A Tutorial on Computational Geometry
A Tutorial on Computational GeometryA Tutorial on Computational Geometry
A Tutorial on Computational GeometryMinh-Tri Pham
 
Polynomial Function and Synthetic Division
Polynomial Function and Synthetic DivisionPolynomial Function and Synthetic Division
Polynomial Function and Synthetic DivisionAleczQ1414
 
Imc2020 day1&2 problems&solutions
Imc2020 day1&2 problems&solutionsImc2020 day1&2 problems&solutions
Imc2020 day1&2 problems&solutionsChristos Loizos
 

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

15 - 12 Feb - Stable Matchings
15 - 12 Feb - Stable Matchings15 - 12 Feb - Stable Matchings
15 - 12 Feb - Stable MatchingsNeeldhara Misra
 
07- 22 Jan - Divide and Conquer
07- 22 Jan - Divide and Conquer07- 22 Jan - Divide and Conquer
07- 22 Jan - Divide and ConquerNeeldhara Misra
 
10 - 29 Jan - Recursion Part 2
10 - 29 Jan - Recursion Part 210 - 29 Jan - Recursion Part 2
10 - 29 Jan - Recursion Part 2Neeldhara 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-UpNeeldhara Misra
 
02 - 04 Jan - Sorting (Continued)
02 - 04 Jan - Sorting (Continued)02 - 04 Jan - Sorting (Continued)
02 - 04 Jan - Sorting (Continued)Neeldhara Misra
 
08 - 25 Jan - Divide and Conquer
08 - 25 Jan - Divide and Conquer08 - 25 Jan - Divide and Conquer
08 - 25 Jan - Divide and ConquerNeeldhara Misra
 
13 - 06 Feb - Dynamic Programming
13 - 06 Feb - Dynamic Programming13 - 06 Feb - Dynamic Programming
13 - 06 Feb - Dynamic ProgrammingNeeldhara Misra
 
00 - 30 Dec - Introduction
00 - 30 Dec - Introduction00 - 30 Dec - Introduction
00 - 30 Dec - IntroductionNeeldhara Misra
 
01 - 01 January - Sorting
01 - 01 January - Sorting01 - 01 January - Sorting
01 - 01 January - SortingNeeldhara Misra
 
14 - 08 Feb - Dynamic Programming
14 - 08 Feb - Dynamic Programming14 - 08 Feb - Dynamic Programming
14 - 08 Feb - Dynamic ProgrammingNeeldhara 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 ProgrammingNeeldhara Misra
 
09 - 27 Jan - Recursion Part 1
09 - 27 Jan - Recursion Part 109 - 27 Jan - Recursion Part 1
09 - 27 Jan - Recursion Part 1Neeldhara Misra
 
12 - 05 Feb - Dynamic Programming
12 - 05 Feb - Dynamic Programming12 - 05 Feb - Dynamic Programming
12 - 05 Feb - Dynamic ProgrammingNeeldhara 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

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 

Recently uploaded (20)

Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 

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)