title: sort array of locations by nearest point
body: <p>So the question is like this:</p>
  
  <blockquote>
    <p>Given a location X and an array of locations, I want to get an array
    of locations that are closest to location X, in other words sorted by
    closest distance.</p>
  </blockquote>
  
  <p>The way I solved this is by iterating through each location array and calculate the distance between X and that particular location, store that distance, and sort the location by distance using a Comparator. Done! Is there a better way to do this? Assuming that the sort is a merge sort, it should be O(n log n). </p>