Allow KNN with k=1

This commit is contained in:
Luis Moreno
2020-10-16 12:28:30 -04:00
parent a2588f6f45
commit 92dad01810
2 changed files with 5 additions and 2 deletions
+3
View File
@@ -41,6 +41,9 @@ impl<'a, T: PartialOrd + Debug> HeapSelection<T> {
pub fn heapify(&mut self) {
let n = self.heap.len();
if n <= 1 {
return;
}
for i in (0..=(n / 2 - 1)).rev() {
self.sift_down(i, n - 1);
}