Saturday 9 March 2019

Distances

There are many different distances but today we will be talking about Manhattan distance and Euclidean distance. Mahattan distance is based on the gridlike street geography of the New York borough of Mahattan.
For 2D : Manhattan Distance's formula is abs(x1-x2)+abs(y1-y2). Euclidean distance's formula is sqrt((x1-x2)^2+(y1-y2)^2). This is equivalent to the Pythagorean theorem.
This chapter is an easy, short and fundamental chapter. (in fact the whole math chapter is easy, short and fundamental)

In the picture, in red, blue and yellow, you have Manhattan distance. And in green is the Euclidean distance.

No comments:

Post a Comment

std::next_permutation(arr.begin(),arr.end());

What is next_permutation(a.begin(),a.end()) ? Next permutation is like what its name says, finds the next permutation of a and assigns ...