SlideShare a Scribd company logo
ACM PROBLEM
TITLE:
THE CLOSEST PAIR
Presented to:
Dr. Abdul Qadir
Dean of Faculty Computing
Department of Computer Science
Mohammad Ali Jinnah University, Islamabad
Presented By:
Mohammad Imran Mukhtar
BC-113004
Department of Computer Science
Mohammad Ali Jinnah University, Islamabad
PROBLEM DESCRIPTION
 Given a set of points in a two dimensional space
 Each set starts with an integer N (0<=N<=10000),
which denotes the number of points in this set.
 Q : We have to find the closest distance between
the two points
HOW TO SOLVE IT?
There are following steps according to which we can solve
this problem :
1. Sort points according to their x-coordinates.
2. SPLIT THE SET OF POINTS INTO TWO EQUAL-SIZED SUBSETS BY A
VERTICAL LINE X=XMID.
3. SOLVE THE PROBLEM RECURSIVELY IN THE LEFT AND RIGHT
SUBSETS. THIS YIELDS THE LEFT-SIDE AND RIGHT-SIDE MINIMUM
DISTANCES DLMIN AND DRMIN, RESPECTIVELY.
Dividing the left side
Now dividing the left side
into sub categories
Continuously dividing Continuously dividing
After that solving the left most side to find the minimum
distance between the two points.
ACM Problem : The Closest Pair
 By putting the values in this formula :
 Distance = sqrt{(1 – 1)2 + (2 – 11)2}
= sqrt{ (0)2 + (-9)2 }
= sqrt{81}
= 9
 Distance = sqrt{(4 – 10)2 + (5 – 6)2}
= sqrt{ (-6)2 + (-1)2 }
= sqrt{36 + 1}
= sqrt{37}
= 6.08
So the minimum distance between the two subsets is 6.08
ACM Problem : The Closest Pair

More Related Content

PDF
Ma3bfet par 10.6 5 aug 2014
PDF
9.6 Systems of Inequalities and Linear Programming
PPTX
7. advantages of digital system
PPTX
Online product of 2-digit sum of unit is 10
PPTX
Gaussian elimination method & homogeneous linear equation
PPT
Gauss elimination
PPTX
Pair of linear equations in 2 variables
PPT
Direct methods
Ma3bfet par 10.6 5 aug 2014
9.6 Systems of Inequalities and Linear Programming
7. advantages of digital system
Online product of 2-digit sum of unit is 10
Gaussian elimination method & homogeneous linear equation
Gauss elimination
Pair of linear equations in 2 variables
Direct methods

What's hot (18)

PDF
Oct 29 Solving Rational Equations
PDF
Gaussian Elimination
PPTX
Accuracy & Precision in Electronics
PPTX
Solving Systems of Equations and Inequalities by Graphing
PDF
3 handouts section3-1
DOC
Lsd ee n
PPTX
deep_coders(sourav,nitin)
PDF
7.4 Classifying Systems
PPTX
linear equation and gaussian elimination
PPTX
Exponents powerpoint
DOCX
Gauss elimination method
PPTX
April 29, 2015
PPTX
Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm
DOCX
4.1-4.3 draw triangles
PPTX
Math chapter 3 non-positive integer exponents with materials
PPT
Solve systemsbygraphing
PPTX
Solving Absolute Value Inequalities
PPT
Graphing sytems inequalities
Oct 29 Solving Rational Equations
Gaussian Elimination
Accuracy & Precision in Electronics
Solving Systems of Equations and Inequalities by Graphing
3 handouts section3-1
Lsd ee n
deep_coders(sourav,nitin)
7.4 Classifying Systems
linear equation and gaussian elimination
Exponents powerpoint
Gauss elimination method
April 29, 2015
Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm
4.1-4.3 draw triangles
Math chapter 3 non-positive integer exponents with materials
Solve systemsbygraphing
Solving Absolute Value Inequalities
Graphing sytems inequalities
Ad

Viewers also liked (20)

PPTX
Weekend in Boca VIII - "The 'Now' of Leadership"
PDF
Sixthcontinent executive summary r10
PPTX
Women’s Symposium - Robin Wilson - "Giving Back to Make a Difference"
PPTX
Censorship - banned films
PPTX
Black Comedy Movies
PDF
Content Marketing Infogrpahic
PPTX
Weekend in Boca VII - Melissa Bradley - "Inspiration, Innovation and Informat...
PDF
10 Painful Facts About Filipino Money Habits
PDF
Presentazione X-Fitness
PPTX
Weekend in Boca VII - Lindsay J.K. Nichols - “21st Century Information Scaffo...
PDF
Företaget Lingbo Textilinredning AB
DOCX
Cara membuat kartun 3D
PPT
Weekend in Boca VII - Richard Crespin - "CollaborateUP"
PDF
Weekend in Boca VII - Diane Remin - “Raise More Money by Keeping Your Donors:...
PPTX
Women’s Symposium – Gila Kurtz - "Giving Back to Make a Difference"
PPT
SixthContinent The Economic Social Network
PPTX
Tes butawarna
PPTX
Weekend in Boca VIII - "The 'Now' of Leadership"
Sixthcontinent executive summary r10
Women’s Symposium - Robin Wilson - "Giving Back to Make a Difference"
Censorship - banned films
Black Comedy Movies
Content Marketing Infogrpahic
Weekend in Boca VII - Melissa Bradley - "Inspiration, Innovation and Informat...
10 Painful Facts About Filipino Money Habits
Presentazione X-Fitness
Weekend in Boca VII - Lindsay J.K. Nichols - “21st Century Information Scaffo...
Företaget Lingbo Textilinredning AB
Cara membuat kartun 3D
Weekend in Boca VII - Richard Crespin - "CollaborateUP"
Weekend in Boca VII - Diane Remin - “Raise More Money by Keeping Your Donors:...
Women’s Symposium – Gila Kurtz - "Giving Back to Make a Difference"
SixthContinent The Economic Social Network
Tes butawarna
Ad

Similar to ACM Problem : The Closest Pair (20)

PDF
Closest pair problems (Divide and Conquer)
PPTX
13-closest-pair (2)-algorithmic-programming.pptx
PDF
Seminar Report (Final)
PDF
A simple study on computer algorithms by S. M. Risalat Hasan Chowdhury
PPT
ClosestPair_Kleinberg_and_Tardos.pptx_enjoy
PDF
06 - 20 Jan - Divide and Conquer
PPTX
CLOSEST PAIR (Final)
PPT
PPT
ClosestPairClosestPairClosestPairClosestPair
PDF
[ACM-ICPC] UVa-10245
PDF
CS345-Algorithms-II-Lecture-1-CS345-2016.pdf
PDF
6-Distance-and-Mifvtyuvgyuugdpoint-Formula (1).pdf
PPT
Lecture slides week14-15
PDF
Poscat seminar 5
PPTX
DISTANCE FORMULA grade 10 fourth quarterdistance formula mathematics 10 grade...
PPTX
ML Study Jams Session 2.pptx
PPT
Chap05alg
PPT
Chap05alg
PPT
Advanced Search Techniques
PDF
2.1 Rectangular Coordinate Systems
Closest pair problems (Divide and Conquer)
13-closest-pair (2)-algorithmic-programming.pptx
Seminar Report (Final)
A simple study on computer algorithms by S. M. Risalat Hasan Chowdhury
ClosestPair_Kleinberg_and_Tardos.pptx_enjoy
06 - 20 Jan - Divide and Conquer
CLOSEST PAIR (Final)
ClosestPairClosestPairClosestPairClosestPair
[ACM-ICPC] UVa-10245
CS345-Algorithms-II-Lecture-1-CS345-2016.pdf
6-Distance-and-Mifvtyuvgyuugdpoint-Formula (1).pdf
Lecture slides week14-15
Poscat seminar 5
DISTANCE FORMULA grade 10 fourth quarterdistance formula mathematics 10 grade...
ML Study Jams Session 2.pptx
Chap05alg
Chap05alg
Advanced Search Techniques
2.1 Rectangular Coordinate Systems

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Institutional Correction lecture only . . .
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Presentation on HIE in infants and its manifestations
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
RMMM.pdf make it easy to upload and study
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Lesson notes of climatology university.
PPTX
Cell Structure & Organelles in detailed.
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
Pharma ospi slides which help in ospi learning
Module 4: Burden of Disease Tutorial Slides S2 2025
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
O7-L3 Supply Chain Operations - ICLT Program
Institutional Correction lecture only . . .
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Supply Chain Operations Speaking Notes -ICLT Program
Presentation on HIE in infants and its manifestations
VCE English Exam - Section C Student Revision Booklet
Anesthesia in Laparoscopic Surgery in India
RMMM.pdf make it easy to upload and study
Microbial disease of the cardiovascular and lymphatic systems
Lesson notes of climatology university.
Cell Structure & Organelles in detailed.
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
102 student loan defaulters named and shamed – Is someone you know on the list?
Computing-Curriculum for Schools in Ghana
Microbial diseases, their pathogenesis and prophylaxis
A systematic review of self-coping strategies used by university students to ...
Pharma ospi slides which help in ospi learning

ACM Problem : The Closest Pair

  • 1. ACM PROBLEM TITLE: THE CLOSEST PAIR Presented to: Dr. Abdul Qadir Dean of Faculty Computing Department of Computer Science Mohammad Ali Jinnah University, Islamabad Presented By: Mohammad Imran Mukhtar BC-113004 Department of Computer Science Mohammad Ali Jinnah University, Islamabad
  • 2. PROBLEM DESCRIPTION  Given a set of points in a two dimensional space  Each set starts with an integer N (0<=N<=10000), which denotes the number of points in this set.  Q : We have to find the closest distance between the two points
  • 3. HOW TO SOLVE IT? There are following steps according to which we can solve this problem : 1. Sort points according to their x-coordinates.
  • 4. 2. SPLIT THE SET OF POINTS INTO TWO EQUAL-SIZED SUBSETS BY A VERTICAL LINE X=XMID.
  • 5. 3. SOLVE THE PROBLEM RECURSIVELY IN THE LEFT AND RIGHT SUBSETS. THIS YIELDS THE LEFT-SIDE AND RIGHT-SIDE MINIMUM DISTANCES DLMIN AND DRMIN, RESPECTIVELY. Dividing the left side Now dividing the left side into sub categories
  • 7. After that solving the left most side to find the minimum distance between the two points.
  • 9.  By putting the values in this formula :  Distance = sqrt{(1 – 1)2 + (2 – 11)2} = sqrt{ (0)2 + (-9)2 } = sqrt{81} = 9  Distance = sqrt{(4 – 10)2 + (5 – 6)2} = sqrt{ (-6)2 + (-1)2 } = sqrt{36 + 1} = sqrt{37} = 6.08 So the minimum distance between the two subsets is 6.08