N closest points to the reference point
Faster sorting
If the only purpose of the distance computation is for comparison, then you can speed it up by removing the call to sqrt().  You'll end up comparing the squares of the distances, which is equivalent to comparing the actual distances.