From 2ce6b06e540f08e0c8e1c751e1eb795887f0b6a1 Mon Sep 17 00:00:00 2001 From: karl Date: Mon, 28 Dec 2020 13:51:14 +0100 Subject: [PATCH] Fix inserted point not being removed from list --- kdtree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kdtree.h b/kdtree.h index 32bf324..6b8ab66 100644 --- a/kdtree.h +++ b/kdtree.h @@ -98,7 +98,7 @@ class KDTree { // TODO: This copies. Can we split the vector into two without copying? std::vector left_of_median(points.begin(), points.begin() + middle); - std::vector right_of_median(points.begin() + middle, points.end()); + std::vector right_of_median(points.begin() + middle + 1, points.end()); // Create node, recursively call to construct subtree return new Node(axis, median, build(left_of_median, depth + 1),