public class FastClosestPair { public final static double INF = java.lang.Double.POSITIVE_INFINITY; public static PointPair closestPair(XYPoint[] points) { XYPoint pointsByX[] = new XYPoint[points.length]; XYPoint pointsByY[] = new XYPoint[points.length]; for (int j = 0; j < points.length; j++) { pointsByX[j] = points[j]; pointsByY[j] = points[j]; } // Ensure sorting precondition for divide-and-conquer algorithm. XComparator xcomp = new XComparator(); YComparator ycomp = new YComparator(); Sort.msort(pointsByX, xcomp); // sort by x-coord Sort.msort(pointsByY, ycomp); // sort by y-coord return findClosestPair(pointsByX, pointsByY); } static PointPair findClosestPair(XYPoint[] pointsByX, XYPoint[] pointsByY) { // You need to write this method. I've put something in so that there // are no compiler or runtime errors. You'll want to replace this line. return new PointPair(null,null,INF); } }