Finding the Closest Pair

This applet implements a Divide-and-Conquer algorithm for finding a closest pair of points (shown in blue). Click the Start Over button to generate a new set of random points of the specified size. The green line with index k indicates the partition of the point set in the k-th recursive call. The algorithm has the time complexity O(n log(n)).

Source code