For a balanced Kd-tree, the average complexity of a K-nearest neighbor (KNN) search is $𝑂(log𝑁+𝐾)$
where:
- $N$ is the number of points in the dataset.
- $K$ is the number of nearest neighbors to find.
In the worst case, where the dataset has a high dimensionality or is highly skewed, the search can degrade to $𝑂(𝑁)$
Effect of Dimensionality
- For low-dimensional spaces (e.g., 2D or 3D), Kd-trees are efficient.
- As the number of dimensions $d$ increases, the efficiency drops.
- In very high dimensions $(𝑑≫10)$, the Kd-tree may perform almost as poorly as a brute-force search.