Skip to content

Commit 257340c

Browse files
authored
Update src/geometry/manhattan-distance.md
1 parent 9520103 commit 257340c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/geometry/manhattan-distance.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Let's think first in one dimension, so $y=0$. The main observation is that we ca
2727
$$|p.x - q.x| = \max(p.x - q.x, -p.x + q.x)$$
2828

2929
So, for example, we can try to have $p$ such that $p.x$ has the plus sign, and then $q$ must have the negative sign. This way we want to find:
30+
3031
$$\max\limits_{p, q \in P}(p.x + (-q.x)) = \max\limits_{p \in P}(p.x) + \max\limits_{q \in P}( - q.x ).$$
3132

3233
Notice that we can extend this idea further for 2 (or more!) dimensions. For $d$ dimensions, we must bruteforce $2^d$ possible values of the signs. For example, if we are in $2$ dimensions and bruteforce that $p$ has both the plus signs we want to find:

0 commit comments

Comments
 (0)