title: How to find two most distant points?
body: <p>This is a question that I was asked on a job interview some time ago. And I still can't figure out sensible answer.</p>
  
  <p>Question is:</p>
  
  <p>you are given set of points (x,y). Find 2 most distant points. Distant from each other.</p>
  
  <p>For example, for points: (0,0), (1,1), (-8, 5) - the most distant are: (1,1) and (-8,5) because the distance between them is larger from both (0,0)-(1,1) and (0,0)-(-8,5).</p>
  
  <p>The obvious approach is to calculate all distances between all points, and find maximum. The problem is that it is O(n^2), which makes it prohibitively expensive for large datasets.</p>
  
  <p>There is approach with first tracking points that are on the boundary, and then calculating distances for them, on the premise that there will be less points on boundary than "inside", but it's still expensive, and will fail in worst case scenario.</p>
  
  <p>Tried to search the web, but didn't find any sensible answer - although this might be simply my lack of search skills.</p>