Skip to main content
Log in

On Constant Factors in Comparison-Based Geometric Algorithms and Data Structures

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

Abstract

Many standard problems in computational geometry have been solved asymptotically optimally as far as comparison-based algorithms are concerned, but there has been little work focusing on improving the constant factors hidden in big-Oh bounds on the number of comparisons needed. In this paper, we consider orthogonal-type problems and present a number of results that achieve optimality in the constant factors of the leading terms, including

  • an algorithm for the 2D maxima problem that uses \(n\lg h + O(n\sqrt{\lg h})\) comparisons, where \(h\) denotes the output size;

  • a randomized algorithm for the 3D maxima problem that uses \(n\lg h + O(n\lg ^{2/3} h)\) expected number of comparisons;

  • a randomized algorithm for detecting intersections among a set of orthogonal line segments that uses \(n\lg n + O(n\sqrt{\lg n})\) expected number of comparisons;

  • a data structure for point location among 3D disjoint axis-parallel boxes that can answer queries in \((3/2)\lg n + O(\lg \lg n)\) comparisons;

  • a data structure for point location in a 3D box subdivision that can answer queries in \((4/3)\lg n + O(\sqrt{\lg n})\) comparisons.

Some of the results can be adapted to solve nonorthogonal problems, such as 2D convex hulls and general line segment intersection. Our algorithms and data structures use a variety of techniques, including Seidel and Adamy’s planar point location method, weighted binary search, and height-optimal BSP trees.

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. Kaligosi et al.’s deterministic algorithm [32] has a larger lower-order term, with \(n\lg b + O(n\lg b\lg \lg \lg b/\lg \lg b)\) comparisons. For an alternative solution, we can divide the input into \(n/s\) groups of size \(s\) and sort each group in total \((n/s)\cdot (s\lg s + O(s))\) number of comparisons; as Frederickson and Johnson [26] described a selection algorithm for \(n/s\) sorted arrays of size \(s\) with \(O((n/s)\lg s)\) running time, \(b\) selections take \(O(b(n/s)\lg s)\) time. Choosing \(s=b\lg b\) gives a deterministic multi-selection algorithm using \(n\lg b + O(n\lg \lg b)\) comparisons.

  2. To deal with the occurrence of \(\delta _\varDelta \), one needs a more carefully defined configuration space when applying their technique; e.g., see  [18, Lemma 4.2].

References

  1. Afshani, P., Barbay, J., Chan, T.M.: Instance-optimal geometric algorithms. In: Proceedings of the 50th Annual IEEE Symposium on Foundations of Computer Science, pp. 129–138 (2009)

  2. Arya, S., Malamatos, T., Mount, D.M., Wong, K.C.: Optimal expected-case planar point location. SIAM J. Comput. 37, 584–610 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  3. Ben-Or, M.: Lower bounds for algebraic computation trees. In: Proceedings of the 15th Annual ACM Symposium on Theory of Computing, pp. 80–86 (1983)

  4. Bentley, J.L., Ottmann, T.A.: Algorithms for reporting and counting geometric intersections. IEEE Trans. Comput. C-28(9), 643–647 (1979)

  5. Chan, T.M.: Optimal output-sensitive convex hull algorithms in two and three dimensions. Discrete Comput. Geom. 16, 361–368 (1996)

    Article  MATH  MathSciNet  Google Scholar 

  6. Chan, T.M.: Output-sensitive results on convex hulls, extreme points, and related problems. Discrete Comput. Geom. 16, 369–387 (1996)

    Article  MATH  MathSciNet  Google Scholar 

  7. Chan, T.M.: Klee’s measure problem made easy. In: Proceedings of the 54th Annual IEEE Symposium on Foundations of Computer Science, pp. 410–419 (2013)

  8. Chan, T.M.: Persistent predecessor search and orthogonal point location on the word RAM. ACM Trans. Algorithms 9(3), 22 (2013)

    Article  MathSciNet  Google Scholar 

  9. Chan, T.M., Chen, E.Y.: Multi-pass geometric algorithms. Discrete Comput. Geom. 37, 79–102 (2007)

    Article  MATH  MathSciNet  Google Scholar 

  10. Chan, T.M., Pǎtraşcu, M.: Transdichotomous results in computational geometry, I: Point location in sublogarithmic time. SIAM J. Comput. 39, 703–729 (2009)

    Article  MATH  MathSciNet  Google Scholar 

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

  12. Chan, T.M., Snoeyink, J., Yap, C.K.: Primal dividing and dual pruning: Output-sensitive construction of 4-d polytopes and 3-d Voronoi diagrams. Discrete Comput. Geom. 18, 433–454 (1997)

    Article  MATH  MathSciNet  Google Scholar 

  13. Chazelle, B., Dobkin, D.P.: Intersection of convex objects in two and three dimensions. J. ACM 34(1), 1–27 (1987)

    Article  MathSciNet  Google Scholar 

  14. Chazelle, B., Matoušek, J.: Derandomizing an output-sensitive convex hull algorithm in three dimensions. Comput. Geom. Theory Appl. 5, 27–32 (1995)

    Article  MATH  Google Scholar 

  15. Chazelle, B., Edelsbrunner, H., Guibas, L.J., Sharir, M.: Algorithms for bichromatic line segment problems and polyhedral terrains. Algorithmica 11, 116–132 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  16. Clarkson, K.L.: New applications of random sampling in computational geometry. Discrete Comput. Geom. 2, 195–222 (1987)

    Article  MATH  MathSciNet  Google Scholar 

  17. Clarkson, K.L.: More output-sensitive geometric algorithms. In: Proceedings of the 35th Annual IEEE Symposium Foundations of Computer Science, pp. 695–702 (1994)

  18. Clarkson, K.L., Shor, P.W.: Applications of random sampling in computational geometry. II. Discrete Comput. Geom. 4, 387–421 (1989)

    Article  MATH  MathSciNet  Google Scholar 

  19. Cunto, W., Munro, J.I.: Average case selection. J. ACM 36, 270–279 (1989)

    Article  MATH  MathSciNet  Google Scholar 

  20. Dobkin, D.P., Lipton, R.J.: On the complexity of computations under varying sets of primitives. J. Comput. Syst. Sci. 18, 86–91 (1979)

    Article  MATH  MathSciNet  Google Scholar 

  21. Dor, D., Zwick, U.: Selecting the median. SIAM J. Comput. 28, 1722–1758 (1999)

    Article  MATH  MathSciNet  Google Scholar 

  22. Dor, D., Zwick, U.: Median selection requires \((2+\varepsilon )n\) comparisons. SIAM J. Discrete Math. 14, 312–325 (2001)

    Article  MATH  MathSciNet  Google Scholar 

  23. Dubé, T.: Dominance range-query: the one-reporting case. In: Proceedings of the 9th Annual ACM Symposium on Computational Geometry, pp. 208–217 (1993)

  24. Dumitrescu, A., Mitchell, J.S.B., Sharir, M.: Binary space partitions for axis-parallel segments, rectangles, and hyperrectangles. Discrete Comput. Geom. 31, 207–227 (2004)

    Article  MATH  MathSciNet  Google Scholar 

  25. Ford, L.R. jr., Johnson, S.M.: A tournament problem. Am. Math. Monthly 66, 387–389 (1959)

  26. Frederickson, G.N., Johnson, D.B.: The complexity of selection and ranking in \(X+Y\) and matrices with sorted rows and columns. J. Comput. Syst. Sci. 24, 197–208 (1982)

    Article  MATH  MathSciNet  Google Scholar 

  27. Golin, M.J.: A provably fast linear-expected-time maxima-finding algorithm. Algorithmica 11, 501–524 (1994)

    Article  MATH  MathSciNet  Google Scholar 

  28. Gonnet, G.H., Munro, J.I.: Heaps on heaps. SIAM J. Comput. 15, 964–971 (1986)

    Article  MATH  MathSciNet  Google Scholar 

  29. Graham, R.L.: An efficient algorithm for determining the convex hull of a finite planar set. Inf. Process. Lett. 1, 132–133 (1972)

    Article  MATH  Google Scholar 

  30. Hershberger, J., Suri, S., Tóth, C.D.: Binary space partitions of orthogonal subdivisions. SIAM J. Comput. 34, 1380–1397 (2005)

    Article  MATH  MathSciNet  Google Scholar 

  31. Jarvis, R.A.: On the identification of the convex hull of a finite set of points in the plane. Inf. Process. Lett. 2, 18–21 (1973)

  32. Kaligosi, K., Mehlhorn, K., Munro, J.I., Sanders, P.: Towards optimal multiple selection. In: Proceedings of the 32nd International Colloquium Automata, Languages and Programming. Lecture Notes in Computer Science, vol. 3580, pp. 103–114. Springer, Heidelberg (2005)

  33. Kirkpatrick, D.G., Seidel, R.: Output-size sensitive algorithms for finding maximal vectors. In: Proceedings of the 1st Annual ACM Symposium Computational Geometry, pp. 89–96 (1985)

  34. Kirkpatrick, D.G., Seidel, R.: The ultimate planar convex hull algorithm? SIAM J. Comput. 15, 287–299 (1986)

    Article  MATH  MathSciNet  Google Scholar 

  35. Knuth, D.E.: Sorting and Searching. The Art of Computer Programming, vol. 3. Addison-Wesley, Reading (1973)

  36. Kung, H.T., Luccio, F., Preparata, F.P.: On finding the maxima of a set of vectors. J. ACM 22, 469–476 (1975)

    Article  MATH  MathSciNet  Google Scholar 

  37. Li, Z., Reed, B.A.: Heap building bounds. In: Proceedings of the 9th Workshop Algorithms Data Structures, vol. 3608, pp. 14–23. Springer, Heidelberg (2005)

  38. Liotta, G., Preparata, F.P., Tamassia, R.: Robust proximity queries: an illustration of degree-driven algorithm design. SIAM J. Comput. 28(3), 864–889 (1998)

    Article  MathSciNet  Google Scholar 

  39. Mehlhorn, K.: Data Structures and Algorithm 1: Sorting and Searching. EATCS Monographs on Theoretical Computer Science, vol. 1. Springer, Heidelberg (1981)

  40. Mulmuley, K.: Computational Geometry: An Introduction Through Randomized Algorithms. Prentice Hall, Englewood Cliffs (1993)

    MATH  Google Scholar 

  41. Ottmann, T., Schuierer, S., Soundaralakshmi, S.: Enumerating extreme points in higher dimensions. In: Proceedings of the 12th Symposium on Theoretical Aspects of Computer Science. Lecture Notes on Computer Science, vol. 900, pp. 562–570. Springer, Heidelberg (1995)

  42. Overmars, M.H., Yap, C.-K.: New upper bounds in Klee’s measure problem. SIAM J. Comput. 20, 1034–1045 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  43. Paterson, M.S., Yao, F.F.: Optimal binary space partitions for orthogonal objects. J. Algorithms 13, 99–113 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  44. Preparata, F.P.: A new approach to planar point location. SIAM J. Comput. 10(3), 473–482 (1981)

    Article  MATH  MathSciNet  Google Scholar 

  45. Preparata, F.P., Shamos, M.I.: Computational Geometry: An Introduction. Springer, New York (1985)

    Book  Google Scholar 

  46. Seidel, R., Adamy, U.: On the exact worst case complexity of planar point location. J. Algorithms 37, 189–217 (2000)

    Article  MATH  MathSciNet  Google Scholar 

  47. Tóth, C.D.: Binary space partitions: Recent developments. In: Combinatorial and Computational Geometry. MSRI Publications, vol. 52, pp. 525–552. Cambridge University Press, Cambridge (2005)

  48. van Emde Boas, P.: On the \(\varOmega (n \log n)\) lower-bound for convex hull and maximal vector determination. Inf. Process. Lett. 10, 132–136 (1980)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Timothy M. Chan.

Additional information

Editors-in-Charge: Siu-Wing Cheng and Olivier Devillers

A preliminary version of this paper has appeared in Proc. 30th ACM Sympos. Comput. Geom., pp. 40–49, 2014. This work was supported by NSERC; part of the work was done during the first author’s visit to the Department of Computer Science and Engineering, Hong Kong University of Science and Technology.

Appendix: Lower Bounds

Appendix: Lower Bounds

Kirkpatrick and Seidel [33, 34] proved an \(\varOmega (n\lg h)\) lower bound for the 2D convex hull and 2D maxima problem (the version in which the output need not be in sorted order) in the algebraic computation tree model using Ben-Or’s technique [3]. Ben-Or’s technique also implies an \(\varOmega (n\lg n)\) lower bound for the orthogonal line segment intersection detection problem. The technique has hidden constant factors, however.

In this section, we note that for 2D maxima and orthogonal segment intersection detection, the hidden constant factor in the lower bounds can be made equal to 1 in the linear decision tree model, where a comparison refers to testing the sign of a linear combination of the input values. Although the model is not as powerful as higher-degree algebraic decision trees, it permits ordinary comparisons between two input coordinates, which are what this paper focuses on anyway. For linear decision trees, a simpler technique [20, 48] suffices. The main observation is that cells in a linear decision tree are intersections of halfspaces and are thus convex.

Maxima in 2D. Let \(F\) consist of all functions \(f:\{1,\ldots ,n\}\rightarrow \{1,\ldots ,h\}\) such that \(f(1),\ldots ,f(h)\) is a permutation of \(\{1,\ldots ,h\}\). Given \(f\in F\), define \(S_f\) to be the sequence of \(n\) points where the \(i\)th point is \((f(i)-\varepsilon i, -f(i)-\varepsilon i)\). Then \(S_f\) has exactly \(h\) maximal points, namely the first \(h\) points.

Suppose that the two inputs \(S_f\) and \(S_g\) \((f,g\in F)\) end up in the same leaf cell of the decision tree. Imagine moving the point positions from \(S_f\) to \(S_g\) linearly. At any moment in time, the input point sequence belongs to the same leaf cell, by convexity. The \(i\)th point can only move along the line \(\{(t-\varepsilon i, -t-\varepsilon i) : t\in \mathbb {R}\}\).

For \(i,j\in \{1,\ldots ,h\}\), the \(i\)th and \(j\)th points cannot change order, for otherwise one of these two points would not be maximal at some moment in time. Thus, \(f(1)=g(1),\ldots , f(h)=g(h)\). In particular, the staircase of the first \(h\) points stays unmoved.

For \(i\in \{h+1,\ldots ,n\}\), the \(i\)th point cannot cross this staircase, for otherwise the set of maximal points would change (assuming a sufficiently small \(\varepsilon >0\)). Thus, \(f(i)=g(i)\).

We conclude that the inputs \(S_f\) over all \(f\in F\) must lie in distinct leaf cells. Consequently, the number of leaf cells is at least \(|F|=h!h^{n-h}\), and the height of the decision tree is at least \(\lg |F| = n\lg h - O(h)\).

In fact, the average depth over \(|F|\) distinct leaves in the decision tree is at least \(\lg |F|\). It follows that the expected number of comparisons on the input \(S_f\) for a random \(f\in F\) is at least \(n\lg h-O(h)\). By Yao’s principle, this gives the same expected lower bound for randomized algorithms.

Theorem 9

Any algorithm that computes the \(h\) maxima of a set of \(n\) points in two dimensions requires at least \(n\lg h - O(h)\) worst-case expected number of comparisons under the linear decision tree model.

Orthogonal Line Segment Intersection Detection. Let \(F\) consist of all pairs \(f=(f_v,f_h)\) where \(f_v,f_h:\{1,\ldots n/2\}\rightarrow \{1,\ldots , n/2\}\) are bijections. Given \(f\in F\), define \(S_f\) to be a sequence of \(n/2\) vertical and \(n/2\) horizontal line segments where the \(i\)th vertical segment has endpoints \((f(i),-1)\) and \((f(i),1)\) and the \(i\)th horizontal segment has endpoints \((f(i)+1/3,0)\) and \((f(i)+2/3,0)\). Then \(S_f\) has no intersections.

Suppose that the two inputs \(S_f\) and \(S_g\) \((f,g\in F)\) end up in the same leaf cell of the decision tree. Imagine moving the coordinates of the segments from \(S_f\) to \(S_g\) linearly. At any moment in time, the input point sequence belongs to the same leaf cell, by convexity. Each segment can only move horizontally. The segments cannot change \(x\)-order, for otherwise the input would have to change from no to yes at some moment in time. We thus have \(f=g\).

We conclude that the inputs \(S_f\) over all \(f\in F\) must lie in distinct leaf cells. Consequently, the number of leaf cells is at least \(|F|=(n/2)!^2\), and the height of the decision tree is at least \(\lg |F| = n\lg n - O(n)\).

As before, we also obtain the same expected lower bound for randomized algorithms.

Theorem 10

Any algorithm that detects the existence of an intersection for a two-dimensional set of \(n\) line segments, each vertical or horizontal, requires at least \(n\lg n - O(n)\) worst-case expected number of comparisons under the linear decision tree model.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Chan, T.M., Lee, P. On Constant Factors in Comparison-Based Geometric Algorithms and Data Structures. Discrete Comput Geom 53, 489–513 (2015). https://doi.org/10.1007/s00454-015-9677-y

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00454-015-9677-y

Keywords

Navigation