Simple implementation of the Knn algorithm