Closest pair of points

Hide text Hide pseudo-code

From the given set of points, find the pair closest to one other. Use the mergesort-based method described in the given pseudocode.

1. Let min be a global floating point variable
   initialized to positive infinity
2. Let cp1 and cp2 be global point variables
   used to store the closest pair found so far
3. Let a be the array used to store the points,
   where the points are arranged in increasing
   order by their X coordinate
4. CLOSEST_PAIR(a,0,a.length-1)

  Created Fri Oct 30 13:52:47 EET 2009 - Powered by SVG-hut