Euclidean vs Chebyshev vs Manhattan Distance ?


You must have encountered with various programming puzzles (e.g. printing concentric rectangular pattern) which could be easily solved by using the concept of Chebyshev distance. There are many popular such puzzles which can be solved using different distance concepts. There are many metrics to calculate a distance between two points p (x1, y1) and q (x2, y2) in xy-plane.

EUCLIDEAN DISTANCE:

The Euclidean distance or Euclidean metric is the "ordinary" (i.e.straight-line) distance between two points in Euclidean space. 


MANHATTAN DISTANCE:

The Manhattan distance, also known as rectilinear distance, city block distance, taxicab metric is defined as the sum of the lengths of the projections of the line segment between the points onto the coordinate axes.


CHEBYSHEV (CHESSBOARD) DISTANCE:

In Chebyshev distance, all 8 adjacent cells from the given point can be reached by one unit i.e diagonal move is valid.



It is also known as chessboard distance, since in the game of chess the minimum number of moves needed by a king to go from one square on a chessboard to another equals the Chebyshev distance between the centers of the squares

0 comments:

Post a Comment