Update distance computation in KNN