Computing the closest pair of points - Naïve approach →
Given a set of points (say provided to us as (x, y) coordinates) on a plane, let us find the closest pair among the set. The straight forward approach would be to compute the distance of each point with every other point in the given set and store the minimum distance.
As you can see this is a O(n^2) algorithm. Can we do better than this? It turns out we can - a topic for a future post.