Diego Malagrida Closest and Farthest Pair of Points ↑ Top

Authors Diego Malagrida GonzálezAndreu Massanet Felix

Published15 Apr 2026

Sectionalgorithms

Closest and Farthest Pair of Points

Brute force against divide and conquer on the same cloud of points, and the measurement of where the clever one starts to pay.

The application window showing a spherical 3D point cloud with coloured lines drawn between the closest and the farthest pair.
The pairs found in a 3D cloud, drawn over the points.

Overview

A Java Swing application that finds the closest and farthest pair of points in a cloud, pitting a brute-force strategy against divide and conquer both visually and in a benchmark.

The closest pair can be had two ways: the naive double loop over every pair, or the classic divide and conquer that splits the plane, solves each half and only re-checks the points that fall inside the boundary strip. The farthest pair is a different shape of problem, since the two most distant points are always vertices of the convex hull, so it gets a quadratic baseline and a hull-based method.

The clouds are generated from a range of statistical distributions, because the crossover point where divide and conquer starts to win is not a constant: it depends on how the points are spread, which is exactly what the benchmark is there to show.

Project 3 of 7 for the Advanced Algorithms course at the Universitat de les Illes Balears, the one on divide and conquer.

javadivide-and-conquercomputational-geometry

← All projects