Manhattantávolság
Manhattantávolság, also known as taxicab geometry or Manhattan distance, is a metric used in a grid-like path. It is the distance between two points in a plane with coordinate geometry, calculated as the sum of the absolute differences of their Cartesian coordinates. Imagine a city with a grid of streets, like Manhattan. To travel from one point to another, you cannot move diagonally. You must follow the streets, turning only at intersections. The Manhattantávolság represents the shortest path you could take by only moving along these horizontal and vertical grid lines.
The formula for Manhattantávolság between two points (x1, y1) and (x2, y2) is |x1 - x2| + |y1 -