Question 3.
We have seen how to compute the closest pair of points in a plane using a divide-and-conquer algorithm. In the algorithm, the distance between two points (x1, y1) and (x2, y2) was taken to be √((x1 - x2)^2 + (y1 - y2)^2). In geometry, we also use other distances. One such distance is the distance Dspecial, which is Dspecial((x1, y1), (x2, y2)) = |x1 - x2| + |y1 - y2|.
Consider the following computational problem:
Input: Given a list L of n points in the plane such that no two points have the same x-coordinate. Assume n > 1.
Output: Distinct points (x1, y1) and (x2, y2) from the list L such that (x1, y1) and (x2, y2) have the smallest Dspecial distance amongst all pairs of distinct points in L.
Example: Let L consist of the pairs (1,2), (5,5), (-5,2). The output of the algorithm should be (1,2), (-5,2).
Requirement: Give an algorithm that solves the above problem in O(n log n) running time. You must explain why your algorithm is correct and attains the stated time bound.