0
$\begingroup$

Let's define distance between two points $(x_1, y_1)$ and $(x_2, y_2)$ as $$|x_2-x_1| + |y_2-y_1|$$.

There are given some points.
I think how to find maximum distance between two arbitrary points (among given points). My inituition is following:
Let's find point $(x, y)$ such that $x+y$ is maximal and $(a, b)$ such that $a+b$ is minimal. I don't know idea about corectness. It is only intuition. Could you help me, please ?

$\endgroup$
0
$\begingroup$

Your idea as stated is incorrect. For example consider the points $$ \{(-100,100),(100,-100),(1,1),(-1,1)\} $$

$\endgroup$
  • $\begingroup$ You are right, so can you help me solve this problem ? I think also about third dimension. $\endgroup$ – user40545 Dec 28 '15 at 18:38
  • $\begingroup$ I think that the only solution that will always work is to try every pair of points. $\endgroup$ – Omnomnomnom Dec 28 '15 at 18:40
  • $\begingroup$ Ok, maybe I say more. I would like to find algorithm for this problem. $\endgroup$ – user40545 Dec 28 '15 at 19:03
  • $\begingroup$ Post a new question. Perhaps you should post the question to a programming site like stackoverflow. $\endgroup$ – Omnomnomnom Dec 28 '15 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.