Question: The closest - pair problem calls for finding the two closest points in a set of n points. It is the simplest of a variety
The closestpair problem calls for finding the two closest points in a set of n
points. It is the simplest of a variety of problems in computational geometry that
deals with proximity of points in the plane or higherdimensional spaces. Points
in question can represent such physical objects as airplanes or post offices as well
as database records, statistical samples, DNA sequences, and so on An airtraffic
controller might be interested in two closest planes as the most probable collision
candidates. A regional postal service manager might need a solution to the closest
pair problem to find candidate postoffice locations to be closed.
One of the important applications of the closestpair problem is cluster analy
sis in statistics. Based on n data points, hierarchical cluster analysis seeks to orga
nize them in a hierarchy of clusters based on some similarity metric. For numerical
data, this metric is usually the Euclidean distance; for text and other nonnumerical
data, metrics such as the Hamming distance see Problem in this sections ex
ercises are used. A bottomup algorithm begins with each element as a separate
cluster and merges them into successively larger clusters by combining the closest
pair of clusters.
For simplicity, we consider the twodimensional case of the closestpair prob
lem. We assume that the points in question are specified in a standard fashion by
their x y Cartesian coordinates and that the distance between two points p i x i
yi and p j xj y j is the standard Euclidean distance
dp i p j
x i xj y i y j
The bruteforce approach to solving this problem leads to the following ob
vious algorithm: compute the distance between each pair of distinct points and
find a pair with the smallest distance. Of course, we do not want to compute the
distance between the same pair of points twice. To avoid doing so we consider
only the pairs of points p i p j for which i j
ClosestPair and ConvexHull Problems by Brute Force
Pseudocode below computes the distance between the two closest points;
getting the closest points themselves requires just a trivial modification.
ALGORITHM BruteForceClosestPairP
Finds distance between two closest points in the plane by brute force
Input: A list P of n n points px y pn xn yn
Output: The distance between the closest pair of points
d infty
for i to n do
for j i to n do
d mind sqrtx i x j y i yj sqrt is square root
return d
Can you design a more efficient algorithm than the one based on the brute
force strategy to solve the closestpair problem for points dots, on
the real lines?solution in the form of pseudo code
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
