@@ -0,0 +1,1096 @@
+package com.matao.fundamentals.exercises;%0A%0Aimport edu.princeton.cs.algs4.Point2D;%0Aimport edu.princeton.cs.algs4.StdOut;%0A%0A/**%0A * Created by matao on 2018/9/28.%0A * %3Cp%3E%0A * Write a Point2D client that takes an integer value N from the command line,%0A * generates N random points in the unit square,%0A * and computes the distance separating the closest pair of points.%0A */%0Apublic class Ex_1_2_01 %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        int N = (int) (Math.random() + 10);%0A        Point2D%5B%5D points = new Point2D%5BN%5D;%0A        for (int i = 0; i %3C N; i++) %7B%0A            points%5Bi%5D = new Point2D(Math.random(), Math.random());%0A            points%5Bi%5D.draw();%0A        %7D%0A        if (N %3E 1) %7B%0A            double min = points%5B0%5D.distanceTo(points%5B1%5D);%0A            for (int i = 0; i %3C N - 1; i++) %7B%0A                for (int j = i + 1; j %3C N; j++) %7B%0A                    if (points%5Bi%5D.distanceTo(points%5Bj%5D) %3C min) %7B%0A                        min = points%5Bi%5D.distanceTo(points%5Bj%5D);%0A                    %7D%0A                %7D%0A            %7D%0A            StdOut.printf(%22Min distance: %25f%22, min);%0A        %7D%0A    %7D%0A%7D%0A

add solution to exercise 1.2.01