Sort vectors according to their distance between them

1.4k Views Asked by At

I have a collection of vectors, let`s say $n$ vectors. I am trying to find an easy way to SORT these vectors in that way that after sorting of vectors $(V_1,V_2,...,V_n)$ the first vector $V_1$ and the last vector $V_n$ will be two furthest vectors. Next $V_{n-1}$ will be the second farthest vector from the $V_1$. $V_{n-2}$ will be the third furthest vector from the $V_1$...and so on. Is there a good algorithm or an easy way to achieve this?

1

There are 1 best solutions below

8
On BEST ANSWER

To find two furthest vectors, compute the convex hull and find needed two points on it, it is O(n log n) in summary.