r/programminghelp • • May 10 '24

Java K-D trees

Hi everyone. I have made an implementation of a K-D tree in java and I was testing the speed of the nearest neighbor search compared to just brute forcing a solution. I noticed that when using a 10D tree the nearest neighbor search is slower than the brute force solution. Significantly slower. Although in lower dimensions like 2-5 the tree is significantly faster. Is this normal or have I made a mistake during the implementation? Also if you have any examples of how to implement nearest neighbor search in a k-d tree in java that would be great.

2 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/_-random-_-person-_ May 11 '24

Ah I see. Thank you for your time :).