Skip to main content
Log in

Orthogonal Range Searching in Moderate Dimensions: k-d Trees and Range Trees Strike Back

  • Published:
Discrete & Computational Geometry Aims and scope Submit manuscript

Abstract

We revisit the orthogonal range searching problem and the exact \(\ell _\infty \) nearest neighbor searching problem for a static set of n points when the dimension d is moderately large. We give the first data structure with near linear space that achieves truly sublinear query time when the dimension is any constant multiple of \(\log n\). Specifically, the preprocessing time and space are \(O(n^{1+\delta })\) for any constant \(\delta >0\), and the expected query time is \(n^{1-1/O(c\log c)}\) for \(d=c\log n\). The data structure is simple and is based on a new “augmented, randomized, lopsided” variant of k-d trees. It matches (in fact, slightly improves) the performance of previous combinatorial algorithms that work only in the case of offline queries [(Impagliazzo et al. in arXiv:1401.5512, 2014) and (Chan in Proceedings of the 26th ACM-SIAM Symposium on Discrete Algorithms (SODA), 2015)]. It leads to slightly faster combinatorial algorithms for all-pairs shortest paths in general real-weighted graphs and rectangular Boolean matrix multiplication. In the offline case, we show that the problem can be reduced to the Boolean orthogonal vectors problem and thus admits an \(n^{2-1/O(\log c)}\)-time non-combinatorial algorithm [Abboud et al. in Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), 2015]. This reduction is also simple and is based on range trees. Finally, we use a similar approach to obtain a small improvement to Indyk’s data structure (J Comput Syst Sci 63(4):627–638, 2001) for approximate\(\ell _\infty \) nearest neighbor search when \(d=c\log n\).

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

Notes

  1. \((p_1,\ldots ,p_d)\) is inside the box \([a_1,b_1]\times \cdots \times [a_d,b_d]\) iff \((-p_1,p_1,\ldots ,-p_d,p_d)\) is dominated by \((-a_1,b_1,\ldots ,-a_d,b_d)\) in \(\mathbb {R}^{2d}\).

  2. Two vectors \((p_1,\ldots ,p_d),(q_1,\ldots ,q_d)\in \{0,1\}^d\) are orthogonal iff \(\sum _{i=1}^d p_iq_i=0\) iff \((p_1,\ldots ,p_d)\) is dominated by \((1-q_1,\ldots ,1-q_d)\) (recalling that our definition of dominance uses non-strict inequality).

  3. There are other options beside recursion here; for example, we could just use a range tree for \(P_J\).

  4. For any \(j_0\in \{1,\ldots ,d\}\), the key observation is that \(\min _{j=1}^d (a_{ij}+x_j) = a_{ij_0}+x_{j_0}\) iff \((a_{ij_0}-a_{i1},\ldots ,a_{ij_0}-a_{id})\) is dominated by \((x_1-x_{j_0},\ldots ,x_d-x_{j_0})\) in \(\mathbb {R}^d\).

  5. Since this particular recurrence is simple enough, an alternative, more direct way is to expand \(T_{d,d}(N)\) into a sum \(\sum _{i\ge 0} {d+i\atopwithdelims ()i}s^i T_{d,0}(N/s^i)\,\le \, \sum _{i\ge 0} O\left( \frac{d+i}{i\sqrt{s}}\right) ^i\cdot AN^{3/2}\), and observe that the maximum term occurs when i is near \(d/\sqrt{s}\)...

References

  1. Abboud, A., Williams, R., Yu, H.: More applications of the polynomial method to algorithm design. In: Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’15), pp. 218–230. SIAM, Philadelphia (2015)

  2. Afshani, P., Chan, T.M., Tsakalidis, K.: Deterministic rectangle enclosure and offline dominance reporting on the RAM. In: Proceedings of the 41st International Colloquium on Automata, Languages, and Programming (ICALP’14), Part I. Lecture Notes in Computer Science, vol. 8572, pp. 77–88. Springer, Heidelberg (2014)

  3. Albers, S., Hagerup, T.: Improved parallel integer sorting without concurrent writing. Inf. Comput. 136(1), 25–51 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  4. Alman, J., Chan, T.M., Williams, R.: Polynomial representations of threshold functions and algorithmic applications. In: Proceedings of the 57th IEEE Symposium on Foundations of Computer Science (FOCS’16), pp. 467–476 (2016)

  5. Alman, J., Williams, R.: Probabilistic polynomials and Hamming nearest neighbors. In: Proceedings of the 56th IEEE Symposium on Foundations of Computer Science (FOCS’15), pp. 136–150 (2015)

  6. Andoni, A., Croitoru, D., Pătraşcu, M.M.: Hardness of nearest neighbor under \(L_\infty \). In: Proceedings of the 49th IEEE Symposium on Foundations of Computer Science (FOCS’08), pp. 424–433 (2008)

  7. Arlazarov, V.L., Dinic, E.A., Kronrod, M.A., Faradzhev, I.A.: On economical construction of the transitive closure of a directed graph. Sov. Math. Dokl. 11, 1209–1210 (1970)

    MATH  Google Scholar 

  8. Chan, T.M.: Geometric applications of a randomized optimization technique. Discret. Comput. Geom. 22(4), 547–567 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  9. Chan, T.M.: All-pairs shortest paths with real weights in \(O(n^3/\log n)\) time. Algorithmica 50(2), 236–243 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  10. Chan, T.M.: More algorithms for all-pairs shortest paths in weighted graphs. SIAM J. Comput. 39(5), 2075–2089 (2010)

    Article  MathSciNet  MATH  Google Scholar 

  11. Chan, T.M.: Speeding up the Four Russians algorithm by about one more logarithmic factor. In: Proceedings of the 26th ACM–SIAM Symposium on Discrete Algorithms (SODA’15), pp. 212–217. SIAM, Philadelphia (2015)

  12. Chan, T.M., Larsen, K.G., Pătraşcu, M.: Orthogonal range searching on the RAM, revisited. In: Proceedings of the 27th ACM Symposium on Computational Geometry (SoCG’11), pp. 1–10. ACM, New York (2011)

  13. Chan, T.M., Pătraşcu, M.: Counting inversions, offline orthogonal range counting, and related problems. In: Proceedings of the 21st ACM–SIAM Symposium on Discrete Algorithms (SODA’10), pp. 161–173. SIAM, Philadelphia (2010)

  14. Chan, T.M., Williams, R.: Deterministic APSP, orthogonal vectors, and more: Quickly derandomizing Razborov–Smolensky. In: Proceedings of the 27th ACM–SIAM Symposium on Discrete Algorithms (SODA’16), pp. 1246–1255. ACM, New York (2016)

  15. Gordon, D.M., Patashnik, O., Kuperberg, G., Spencer, J.H.: Asymptotically optimal covering designs. J. Comb. Theory Ser. A 75(2), 270–280 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  16. Han, Y., Takaoka, T.: An \(O(n^3\log \log n/\log ^2n)\) time algorithm for all pairs shortest paths. In: Proceedings of the 13th Scandinavian Workshop on Algorithm Theory (SWAT’12). Lecture Notes in Computer Science, vol. 7357, pp. 131–141. Springer, Heidelberg (2012)

  17. Har-Peled, S., Indyk, P., Motwani, R.: Approximate nearest neighbor: towards removing the curse of dimensionality. Theory Comput. 8(1), 321–350 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  18. Impagliazzo, R., Lovett, S., Paturi, R., Schneider, S.: 0-1 integer linear programming with a linear number of constraints (2014). arXiv:1401.5512

  19. Indyk, P.: On approximate nearest neighbors under \(l_\infty \) norm. J. Comput. Syst. Sci. 63(4), 627–638 (2001)

    Article  MathSciNet  MATH  Google Scholar 

  20. Larsen, K.G., Williams, R.: Faster online matrix-vector multiplication. In: Proceedings of the 28th ACM–SIAM Symposium on Discrete Algorithms (SODA’17), pp. 2182–2189. SIAM, Philadelphia (2017)

  21. Le Gall, F.: Powers of tensors and fast matrix multiplication. In: Proceedings of the 39th International Symposium on Symbolic and Algebraic Computation (ISSAC’14), pp. 296–303. ACM, New York (2014)

  22. Le Gall, F., Urrutia, F.: Improved rectangular matrix multiplication using powers of the Coppersmith–Winograd tensor. In: Proceedings of the 29th ACM–SIAM Symposium on Discrete Algorithms (SODA’18), pp. 1029–1046. SIAM, Philadelphia (2018)

  23. Matoušek, J.: Computing dominances in \(E^n\). Inf. Process. Lett. 38(5), 277–278 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  24. Preparata, F.P., Shamos, M.I.: Computational Geometry: An Introduction. Texts and Monographs in Computer Science. Springer, New York (1985)

    Book  MATH  Google Scholar 

  25. Thorup, M.: Randomized sorting in \(O(n\log \log n)\) time and linear space using addition, shift, and bit-wise Boolean operations. J. Algorithms 42(2), 205–230 (2002)

    Article  MathSciNet  MATH  Google Scholar 

  26. Williams, R.: A new algorithm for optimal 2-constraint satisfaction and its implications. Theor. Comput. Sci. 348(2–3), 357–365 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  27. Williams, R.: Matrix-vector multiplication in sub-quadratic time (some preprocessing required). In: Proceedings of the 18th ACM–SIAM Symposium on Discrete Algorithms (SODA’07), pp. 995–1001. ACM, New York (2007)

  28. Williams, R.: Multiplying matrices faster than Coppersmith–Winograd. In: Proceedings of the 44th Symposium on Theory of Computing (STOC’12), pp. 887–898. ACM, New York (2012)

  29. Williams, R.: Faster all-pairs shortest paths via circuit complexity. In: Proceedings of the 46th ACM Symposium on Theory of Computing (STOC’14), pp. 664–673. ACM, New York (2014)

  30. Yu, H.: An improved combinatorial algorithm for Boolean matrix multiplication. In: Proceedings of the 42nd International Colloquium on Automata, Languages, and Programming (ICALP’15), Part I. Lecture Notes in Computer Science, vol. 9134, pp. 1094–1105. Springer, Heidelberg (2015)

Download references

Acknowledgements

Funding was provided by National Science Foundation (Grant No. CCF-1814026).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Timothy M. Chan.

Additional information

Editor in Charge: Kenneth Clarkson

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Much of this work was done while the author was at the Cheriton School of Computer Science, University of Waterloo. A preliminary version of this work appeared in: Proc. 33rd Sympos. Comput. Geom., pp. 27:1–27:15, 2017.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Chan, T.M. Orthogonal Range Searching in Moderate Dimensions: k-d Trees and Range Trees Strike Back. Discrete Comput Geom 61, 899–922 (2019). https://doi.org/10.1007/s00454-019-00062-5

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00454-019-00062-5

Keywords

Mathematics Subject Classification

Navigation