kdtree -correct solution