KNN kd tree realization with example