Euclidean vs Chebyshev vs Manhattan Distance
I have learned new things while trying to solve programming puzzles. One of these is the calculation of distance.
There are many metrics to calculate a distance between 2 points p (x1, y1) and q (x2, y2) in xy-plane. We can count Euclidean distance, or Chebyshev distance or manhattan distance, etc. Each one is different from the others.
To simplify the idea and to illustrate these 3 metrics, I have drawn 3 images as shown below.
The first one is Euclidean distance. The distance can be defined as a straight line between 2 points. The formula to calculate this has been shown in the image.
In Chebyshev distance, all 8 adjacent cells from the given point can be reached by one unit.
The last one is also known as L1 distance. The distance between two points is the…
Vezi articolul original 129 de cuvinte mai mult