Algorithmica

, Volume 75, Issue 4, pp 684–723

# On the Cost of Fixed Partial Match Queries in K-d Trees

• Amalia Duch
• Gustavo Lau
Article

## Abstract

Partial match queries constitute the most basic type of associative queries in multidimensional data structures such as $$K$$-d trees or quadtrees. Given a query $$\mathbf {q}=(q_0,\ldots ,q_{K-1})$$ where s of the coordinates are specified and $$K-s$$ are left unspecified ($$q_i=*$$), a partial match search returns the subset of data points $$\mathbf {x}=(x_0,\ldots ,x_{K-1})$$ in the data structure that match the given query, that is, the data points such that $$x_i=q_i$$ whenever $$q_i\not =*$$. There exists a wealth of results about the cost of partial match searches in many different multidimensional data structures, but most of these results deal with random queries. Only recently a few papers have begun to investigate the cost of partial match queries with a fixed query $$\mathbf {q}$$. This paper represents a new contribution in this direction, giving a detailed asymptotic estimate of the expected cost $$P_{{n},\mathbf {q}}$$ for a given fixed query $$\mathbf {q}$$. From previous results on the cost of partial matches with a fixed query and the ones presented here, a deeper understanding is emerging, uncovering the following functional shape for $$P_{{n},\mathbf {q}}$$
\begin{aligned} P_{{n},\mathbf {q}} = \nu \cdot \left( \prod _{i:q_i\text { is specified}}\, q_i(1-q_i)\right) ^{\alpha /2}\cdot n^\alpha + \text {l.o.t.} \end{aligned}
(l.o.t. lower order terms, throughout this work) in many multidimensional data structures, which differ only in the exponent $$\alpha$$ and the constant $$\nu$$, both dependent on s and K, and, for some data structures, on the whole pattern of specified and unspecified coordinates in $$\mathbf {q}$$ as well. Although it is tempting to conjecture that this functional shape is “universal”, we have shown experimentally that it seems not to be true for a variant of $$K$$-d trees called squarish $$K$$-d trees.

## Keywords

Multidimensional search Partial match search K-dimensional search trees Analysis of algorithms Multidimensional data structures

## Notes

### Acknowledgments

We are very thankful to the two anonymous reviewers of this manuscript for their detailed reports and useful suggestions.

## References

1. 1.
Bentley, J.L.: Multidimensional binary search trees used for associative retrieval. Commun. ACM 18(9), 509–517 (1975)
2. 2.
Bentley, J.L., Finkel, R.A.: Quad trees: a data structure for retrieval on composite keys. Acta Inform. 4(1), 1–9 (1974)
3. 3.
Broutin, N., Neininger, R., Sulzbach, H.: A limit process for partial match queries in random quadtrees and 2-d trees. Ann. Appl. Probab. 23(6), 2560–2603 (2013)
4. 4.
Chanzy, P., Devroye, L., Zamora-Cura, C.: Analysis of range search for random $$k$$-d trees. Acta Inform. 37(4–5), 355–383 (2001)
5. 5.
Chern, H.-H., Hwang, H.-K.: Partial match queries in random $$k$$-d trees. SIAM J. Comput. 35(6), 1440–1466 (2006)
6. 6.
Curien, N., Joseph, A.: Partial match queries in two-dimensional quadtrees: a probabilistic approach. Adv. Appl. Probab. 43(1), 178–194 (2011)
7. 7.
Cunto, W., Lau, G., Flajolet, Ph.: Analysis of $$k$$d-trees improved by local reorganisations. In: Dehne, F., Sack, J.-R., Santoro, N. (eds.), Workshop on Algorithms and Data Structures (WADS’89), Volume 382 of Lecture Notes in Computer Science, pp. 24–38. Springer (1989)Google Scholar
8. 8.
Duch A., Estivill-Castro, V., Martínez, C.: Randomized $$k$$ International Symposium on Algorithms and Computation (ISAAC), Volume 1533 of Lecture Notes in Computer Science, pp. 199–208. Springer (1998)Google Scholar
9. 9.
Duch, A., Jiménez, R.M., Martínez, C.: Selection by rank in $$k$$-dimensional binary search trees. Random Struct. Algorithms 45(1), 14–37 (2014)
10. 10.
Devroye, L., Jabbour, J., Zamora-Cura, C.: Squarish $$k$$-d trees. SIAM J. Comput. 30(5), 1678–1700 (2000)
11. 11.
Duch, A., Lau, G., Martínez, C.: On the average performance of fixed partial match queries in random relaxed $$k$$ International Meeting on Probabilistic, Combinatorial and Asymptotic Methods for the Analysis of Algorithms (AofA). Discrete Mathematics & Theoretical Computer Science (Proceedings), pp. 103–114 (2014)Google Scholar
12. 12.
Duch, A., Martínez, C.: On the average performance of orthogonal range search in multidimensional data structures. J. Algorithms 44(1), 226–245 (2002)
13. 13.
Feller, W.: An Introduction to Probability Theory and Its Applications. Wiley, New York (1971)
14. 14.
Flajolet, Ph, Odlyzko, A.: Singularity analysis of generating functions. SIAM J. Discrete Math. 3(1), 216–240 (1990)
15. 15.
Flajolet, Ph, Puech, C.: Partial match retrieval of multidimensional data. J. ACM 33(2), 371–407 (1986)
16. 16.
Flajolet, Ph, Sedgewick, R.: Analytic Combinatorics. Cambridge University Press, Cambridge (2009)
17. 17.
Johnson, N.L., Kotz, S., Kemp, A.W.: Univariate Discrete Distributions, 2nd edn. Wiley, New York (1992)
18. 18.
Martínez, C., Panholzer, A., Prodinger, H.: Partial match queries in relaxed multidimensional search trees. Algorithmica 29(1–2), 181–204 (2001)