Possible Duplicate:
Greatest linear dimension 2d set of points
I could compute the distance between each point and take the largest but that doesn’t sound like a very efficient way to do it when there are a large (> 1000) number of points.
Note: This is for iPhone so I don’t have a ton of processing power.
You’re asking to compute the diameter of the set. The standard technique is to first compute the convex hull, which reduces the problem to finding the diameter of a convex polygon. Even in the case where you don’t eliminate any points, this added information is exactly what’s needed to solve the problem efficiently. However, finding the diameter of a convex polygon is not entirely trivial; several published papers with algorithms for this task turn out to be incorrect.
Here’s a fairly readable discussion of a correct O(n) algorithm for the task (where n is the number of points in the convex hull).
Also, note the the iphone isn’t that limited; a carefully written implementation of even the completely naive algorithm can handle 1000 points in less than a tenth of a second. Of course, using the correct algorithm will let you go much faster =)