TheAlgorithms / Rust

All Algorithms implemented in Rust
MIT License
22.92k stars 2.24k forks source link

A KD-Tree (K-Dimensional Tree) #844

Open bomenderick opened 1 week ago

bomenderick commented 1 week ago

A K-D Tree (also known as a K-Dimensional Tree) is a binary search tree where each node contains a K-Dimensional point in space. Essentially, it is a space-partitioning data structure used to organize points in a K-Dimensional space, which facilitates the search for nearest neighbors.

In addition to the basic operations of insertion, search, and deletion, this implementation also supports nearest neighbor searches and median finding to maintain balance during insertions. Furthermore, it includes a merge method that allows the combination of two K-D Trees by gathering their points and constructing a balanced K-D Tree from them.

Read more:

https://www.geeksforgeeks.org/search-and-insertion-in-k-dimensional-tree/ https://www.geeksforgeeks.org/deletion-in-k-dimensional-tree/

codecov-commenter commented 4 days ago

Codecov Report

Attention: Patch coverage is 96.18768% with 13 lines in your changes missing coverage. Please review.

Project coverage is 95.43%. Comparing base (41c76e4) to head (bf5be5c). Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/data_structures/kd_tree.rs 96.18% 13 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #844 +/- ## ========================================== + Coverage 95.42% 95.43% +0.01% ========================================== Files 316 317 +1 Lines 22754 23095 +341 ========================================== + Hits 21713 22041 +328 - Misses 1041 1054 +13 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.