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\).
Similar content being viewed by others
Notes
\((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}\).
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).
There are other options beside recursion here; for example, we could just use a range tree for \(P_J\).
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\).
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
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)
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)
Albers, S., Hagerup, T.: Improved parallel integer sorting without concurrent writing. Inf. Comput. 136(1), 25–51 (1997)
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)
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)
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)
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)
Chan, T.M.: Geometric applications of a randomized optimization technique. Discret. Comput. Geom. 22(4), 547–567 (1999)
Chan, T.M.: All-pairs shortest paths with real weights in \(O(n^3/\log n)\) time. Algorithmica 50(2), 236–243 (2008)
Chan, T.M.: More algorithms for all-pairs shortest paths in weighted graphs. SIAM J. Comput. 39(5), 2075–2089 (2010)
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)
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)
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)
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)
Gordon, D.M., Patashnik, O., Kuperberg, G., Spencer, J.H.: Asymptotically optimal covering designs. J. Comb. Theory Ser. A 75(2), 270–280 (1996)
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)
Har-Peled, S., Indyk, P., Motwani, R.: Approximate nearest neighbor: towards removing the curse of dimensionality. Theory Comput. 8(1), 321–350 (2012)
Impagliazzo, R., Lovett, S., Paturi, R., Schneider, S.: 0-1 integer linear programming with a linear number of constraints (2014). arXiv:1401.5512
Indyk, P.: On approximate nearest neighbors under \(l_\infty \) norm. J. Comput. Syst. Sci. 63(4), 627–638 (2001)
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)
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)
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)
Matoušek, J.: Computing dominances in \(E^n\). Inf. Process. Lett. 38(5), 277–278 (1991)
Preparata, F.P., Shamos, M.I.: Computational Geometry: An Introduction. Texts and Monographs in Computer Science. Springer, New York (1985)
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)
Williams, R.: A new algorithm for optimal 2-constraint satisfaction and its implications. Theor. Comput. Sci. 348(2–3), 357–365 (2005)
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)
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)
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)
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)
Acknowledgements
Funding was provided by National Science Foundation (Grant No. CCF-1814026).
Author information
Authors and Affiliations
Corresponding author
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
About this article
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
Received:
Revised:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00454-019-00062-5
Keywords
- Geometric data structures
- Range searching
- Nearest neighbor searching
- k-d trees
- Range trees
- All-pairs shortest paths
- Boolean matrix multiplication