adding template knn to misc directory