### a question from《learning opencv3》 chapter 14

Hi,i have some problem when soloving a question from《learning opencv3》 chapter 14

the question is

We can find the extremal points (i.e., the two points that are farthest apart) in a
closed contour of N points by comparing the distance of each point to every
other point.

a. What is the complexity of such an algorithm?

b. Explain how you can do this faster.

I think ,the answer of a is O(N*N) (am i right),but to b,the only idea i can think out is

Finding the convex hull of the contour,
do the algorithm above at the convex hull .

ami i right?or better solution?

thanks！

jsxyhelu