For this problem, we will use the k-NN algorithm—*k* here means that we will look at *k*-closest neighbors. Given a white point, it will be classified as an area of water if the majority of its *k*-closest neighbors are in an area of water and classified as land if the majority of its *k*-closest neighbors are an area of land. We will use the Euclidean metric for the distance: given two points, *X=[x _{0},x_{1}]* and

*Y=[y*, their Euclidean distance is defined as

_{0},y_{1}]*d*.

_{Euclidean}= sqrt((x_{0}-y_{0})^{2}+(x_{1}-y_{1})^{2})The Euclidean distance is the most common metric. Given two points on a piece of paper, their Euclidean distance is just the length between the two points, as measured by a ruler, as shown in the following diagram:

To apply the k-NN algorithm to ...