kNN implemented by c++ version 1.0