Incremental -Lowest Planes and Planar -Nearest Neighbor with Optimal Query Time
Abstract
In a set of planes in , the -lowest planes query asks for the lowest planes pierced by a vertical line . In this paper we describe a semi-dynamic insertion-only data structure that answers -lowest planes queries in optimal time. Our data structure uses space, where is the number of stored planes, and supports insertions in amortized time. This result provides the first query optimal data structures for several fundamental problems:
-
An insertion-only structure that answers 3D halfspace range reporting queries on a set of points in time, where is the number of reported points.
-
An insertion-only structure that answers 3D vertical ray shooting queries on a set of planes in time, where is the number of reported planes.
-
An insertion-only structure that answers planar -nearest neighbor queries in time for any prescribed (specified at query time).
-
An insertion-only structure that answers planar circular range reporting queries in time , where is the number of reported points.
For all of the above problems the query bound is optimal, even in the static scenario. All of the above structures use linear space and support insertions in amortized time.
We also obtain a query optimal static structure for a 4D problem. That is, one can compute in near-linear time a data structure that answers weighted halfspace range reporting queries in time, where is the number of reported points. The structure uses near-linear space.
Keywords and phrases:
Data Structures, Dynamic Data Structures, Nearest-Neighbor QueriesCategory:
Track A: Algorithms, Complexity and GamesCopyright and License:
2012 ACM Subject Classification:
Theory of computation Computational geometry ; Theory of computation Data structures design and analysisAcknowledgements:
Many thanks to all contributors of Vorosketch and Ipe.Funding:
Work supported by the Fonds de la Recherche Scientifique โ FNRS. Supported by the National Science Foundation under NSF grant 2203278. This research was funded in whole or in part by the Austrian Science Fund (FWF) 10.55776/PAT2190825.Editors:
Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele PuppisSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl โ Leibniz-Zentrum fรผr Informatik
1 Introduction
Data structures for sets of 3D planes have been studied extensively. Some important examples of such problems are 3D halfspace range reporting [1] and dynamic 3D convex hull [5].
In this paper we study the following -lowest planes problem: A set of three-dimensional planes is stored in a data structure. For any query tuple , where is a vertical line and is a positive integer, we must report the -lowest planes pierced by . We investigate this problem in the semi-dynamic insertion-only scenario and describe a data structure with amortized insertion time that supports -lowest planes queries in optimal time. Using this, we obtain improved solutions for extensively studied problems.
Results.
Our main result is the insertion-only data structure that answers -lowest planes queries in optimal time . This data structure can be used to obtain optimal query time for several semi-dynamic and static problems. Henceforth we use to denote the number of geometric objects (points, planes) stored in the data structure and we use to denote the number of geometric objects that are reported when we answer a query.
-
1.
Vertical ray shooting in a set of 3D planes. A vertical ray shooting query , for a three-dimensional point , asks for all planes that are pierced by the downward vertical ray from . We obtain a semi-dynamic insertion-only data structure that answers vertical ray shooting queries in time.
-
2.
Halfspace range reporting in a set of 3D points. A halfspace range reporting query asks for all points that are below a plane . We obtain a semi-dynamic insertion-only data structure that answers halfspace range reporting queries in time.
-
3.
Nearest neighbor in a set of planar points. A nearest neighbor query , for a two-dimensional point , asks for the point that is closest to . A -nearest neighbor query , for a point and integer , asks for points that are closest to . We describe a semi-dynamic insertion-only data structure that answers -nearest neighbor queries in time for any ; integer can be specified at query time.
-
4.
Circular range reporting in a set of planar points. A circular range reporting query asks for all points in the circle with center and radius . We obtain a semi-dynamic insertion-only data structure that answers circular range reporting queries in time.
-
5.
Weighted halfspace range reporting. In this generalization of halfspace reporting, each 3D point has an additional coordinate called weight. A weighted halfspace reporting query , for a 3D plane and reals and , asks for all points that are below and have weight within . We describe a static data structure that answers weighted halfspace reporting queries in time.
(This result is somewhat unexpected because weighted halfspace reporting is a 4D problem. For comparison, the fastest currently known data structure for orthogonal range reporting in 4D answers queries in time in the pointer machine model [22].)
All semi-dynamic data structures use space and support insertions in amortized time. Our static structure for weighted halfspace reporting uses space.
Related Work.
The complexity of the -lowest planes problem, and almost all its applications that we consider in this paper, are well understood in static scenarios. If is fixed at preprocessing time, we can work with the -level of the set of planes. The -level of a set of planes is a polyhedral terrain of complexity [23]. The fastest known deterministic construction takes time [8]. In order to answer the -lowest planes query it is sufficient to find the face of the -level that is pierced by , which can be solved in time. If is prescribed at query time, state-of-the-art solutions are based on a hierarchy of -shallow cuttings with values that form a geometric series. Chan and Tsakalidis [9] showed that such a hierarchy can be computed in deterministic time, which yields a simple data structure with query time. The space bound of this approach can be made , while retaining the query bound, using 3D halfspace range reporting queries from the (recursive) structure of Afshani and Chan [1], which was derandomized in [9].
Halfspace range reporting with query time and updates is only known for 2D, which degrades to query time in 3D [6, Section 3], since interval trees and fractional cascading do not generalize [11].
For weighted halfspace reporting, one can use a range tree on the weights of points to obtain a data structure with space and query time. Since this variant of halfspace reporting is a 4D problem, this query time appears to be close to optimal. However, the very recent data structure of Afshani et al. [2] supports weighted halfspace reporting queries in time, for a given query plane and weight range .
If insertions and deletions are required, one can answer -nearest neighbor queries in time with polylogarithmic updates [7]. In [13] de Berg and Staals extended this result to -nearest neighbor and obtained a data structure with query time. Improving the query time of these works is challenging; most progress has been made on update time [5, 19, 7].
Recently, Iacono and Nekrich [17] described a novel, insertion-only structure that answers -nearest neighbor queries in time with amortized insertion time, where can be made an arbitrary small constant.
Contribution and Overview.
This work is inspired by the query time result in [17] for incremental planar -nearest neighbor, that introduced a sampling technique that allows maintaining the optimal query time, with amortized insertion cost. However, immediate extension to the incremental -lowest planes problem is quite unclear, already for , since the algorithms and correctness arguments heavily rely on Euclidean distances and geometric observations about the Voronoi cells around points.
One contribution of our work is to simplify their approach into a more general framework, that applies to the incremental -lowest planes problem. Specifically, we show in Sectionย 3 that query correctness, and the query time, can be established based on a suitable implicit representation of (sample augmented) sets of planes. This is somehow surprising, as a query may, for example, ask for the -lowest planes in some . In obtaining the explicit answer of the reporting query, we are tackling the difficulty that our technique, which gives the speedup, prevents direct access to the known Heap-Selection techniques from [13, 15, 18]. To solve this, we introduce a Deduplication Lemma in Subsectionย 3.1 for such sampling techniques, which allows us to obtain the optimal query time.
Our Sectionย 4 shows how to reduce space to , which we believe is of general interest for several dynamic problems (beside -lowest planes). Sectionย 5 shows how to obtain the first optimal bounds for aforementioned applications 1-5 from our proposed method.
We see the obtained generalization to the -lowest problem and the Deduplication Lemma as the main technical contributions of this work. Furthermore, our proofs in Sectionย 3 proceed in three abstract steps (i) query correctness, (ii) construction time, and (iii) query runtime, which makes our framework easily accessible for future work on optimal query time.
Though our insertion bound for the -lowest planes problem is considerably larger than the almost logarithmic bound for planar -nearest neighbor from [17], we believe that it is very challenging to improve the insertion bound to a sub-cubic exponent (see proof of Lemma 5). While it is an interesting technical problem to accelerate our Skip-Decider construction, one barrier would remain. A central obstacle that comes with our approach is the apparent complexity of the -level of a set of planes, where the best known bound remained unchanged for decades [23].
2 Preliminaries: The -Level of Planes and Planar Triangulations
We rely on the standard, general position assumption: Any point is contained in planes, and no plane in contains a vertical line. For example, any vertical query line intersects all planes. The at most -level of a set of planes , denoted by , is the set of points from that is the closure of the region of points that have planes below it. The -level is a polyhedral surface with vertices [3, Sec. 3][23], and the fastest known algorithm computes it in deterministic time [8]. Recall that the -level of planes, tangent to the (downward opened) lifting paraboloid [12, Sec. 11.5], is in one-to-one relation to the planar order- Voronoi diagram.
We will frequently project (sets of) points in 3D with an orthogonal projection down into the -plane at , and work with 2D objects in that plane. This will simply be referred to as projection (into the plane) throughout the entire paper.
In our insertion algorithm, we will frequently compute the -level of certain subsets where is a fixed integer, project it into the plane, and triangulate the faces. The number of faces in the triangulation is near-linear in for small . Any face of the triangulation shares a common boundary with two or three other faces, and any unbounded face is bounded by two rays and possibly one segment. We call the unbounded faces degenerate triangles, as they may contain only one or two corner points. (See Figureย 1.) For a vertical query line that intersects an edge of the -level, we allow either set of -lowest planes from the faces as query result. That is, we allow that ties are broken arbitrarily in reporting queries, and thus assume that queries intersect triangles in their interior.
We will also use algorithms for computing separators in a planar graph with nodes [15, 16, 21], specifically in the triangle-adjacency graph described above. Using [21, Sec. 2.5], for given integer one can compute in time a decomposition in connected components, where each connected component contains nodes, from which are in the separator. Such a separator has nodes.
Let us remark that points on the -level with equal sets of planes below are connected; see Lemma 1. We denote the -lowest planes of in vertical line by -lowest().
Lemma 1 (Convexity).
Let and denote the vertical lines through some points and respectively. Let be an arbitrary point on the segment , spanned by and and let denote the vertical line through the point .
If -lowest-lowest, then -lowest.
(See Appendixย A for a standard proof.)
3 Optimal -lowest Queries with Fast Plane Insertion
Our insertion-only data structure is based on the Bentley-Saxe (BS) partial-rebuilding approach for decomposable search problems [4]. There, a list of subsets that partition the semi-dynamic set is maintained, with one static structure for each non-empty . Let integer denote the number of planes at time of the last complete rebuild of one static structure ( and for ). Taking , and maintaining set sizes leads to sets in the partition, and amortized insertion cost , where bounds the ratios of the construction time , of static structures for , after insertions.
Static data structures with query time can be obtained from the known deterministic time construction of (a hierarchy of) shallow cuttings in [9]. The space bound can be reduced to by on-the-fly recomputation of conflict-lists with a known optimal half-space range-reporting structure [1, 9]. (This idea is credited to Afshani after Corollary 10 in [7].) Running the standard linear time -Selection algorithm [14, Sec. 1.8] then yields the planes that are lowest in vertical line in time. Using this optimal static structure, combined with the Heap-Selection method of [13, Thm. 1], immediately yields query time for -lowest planes in the insertion-only setting. This solution is optimal for queries with large .
Thus, the remainder of this section is concerned with the difficult cases of , though we will combine our approach (Subsectionย 3.1) with the structure from [9] and Heap-Selection from [13], and in Sectionย 4 with the known, optimal static structure above.
Let throughout the entire paper. Our data structure contains:
-
: A partition of the semi-dynamic set . Set has size .
-
: Set contains all planes of as well as some from the sets , .
The added planes serve a similar purpose as samples in classical fractional cascading. -
: A triangulation of the projection of the -level of .
-
For any , is the set of -lowest planes from for any that intersects .
-
is a subset of the triangles of . The planes are in .
Description here omits additional search structures attached to each set , and each triangle . The full details are described in Lemma 5, which shows that they can be computed in near-linear time. Our query method is a greedy trial-and-error approach, that relies on two functions FIX and SKIP, that we formalize in Lemma 2 and Lemma 4.
Intuitively, any greedy-step assumes that a โtentative resultโ for is โcorrectโ for even larger prefixes of BS sets. For certain extension lengths , this assumption is checked โquicklyโ with an approximate decider111Suitable approximate deciders have a one-sided error, i.e. have reliable True answers but may return False even if a tentative result is valid for the prefix. SKIP. On rejection, the FIX step then โquicklyโ computes a new tentative result, and index , such that the result is correct for the prefix . Transition from to is called a greedy-step, and it involves several SKIP and one FIX calls. This completes the abstract high-level description of our query method, which we formalize in detail below.
Next, we specify what โquicklyโ means for a greedy-step in the context of BS sets, after which we will specify what โtentative resultโ and โcorrect for a prefixโ means in the context of our search problem, -lowest planes in .
Doing a greedy-step โquicklyโ.
As it turns out for the -lowest planes problem, the structures obtained from algorithm CONSTRUCT in Lemma 5 will allow performing one greedy-step, from to , in time (cf. Lemmas 6 and 7). That is, the total query time then telescopes to optimal
| (1) | ||||
| (2) |
time, regardless of the number of greedy-steps. With respect to the -lowest planes problem, the proposed greedy trial-and-error approach for queries can be described concisely with the pseudo-code in Figureย 2.
A naรฏve implementation for the post-processing PRUNE runs in time, since each of triangles in the sequence has elements in .
In the following lemma, we define the semantics of SKIP and what an evaluation to True implies for -lowest. After this, Lemma 4 will then discuss the semantic of FIX and what โtentative resultโ and โcorrect for a prefixโ means. Discussion of how quickly SKIP and FIX can be computed with suitable data structures is carried out in Lemmas 5, 6, and 7.
Lemma 2 (SKIP-Correctness).
Let indices , triangle intersect in point , planar region for any , and for all triangles .
Define SKIP.
If SKIP, then -lowest-lowest.
Proof.
We call degenerate triangles just triangles in the following, as the arguments will hold regardless of corner count. It suffices to show for arbitrary , that
| (3) |
Since is the triangle that intersects vertical line , we have -lowest. See Figureย 3.
Consider the set of points on the polyhedral surface where the -lowest planes coincide with . Let be the orthogonal projection of . (In other words, the region of queries that may be skipped as their set of -lowest planes is equal to .) The implication (3) follows, if we can show that is true.
If , then and the implication is true222In other words, SKIP returns False in this case.. So let be arbitrary. Since of some , we have -lowest are in the augmented set, i.e. . From , we have that -lowest. Thus, and .
The lemma now follows from being convex, due to being convex (Lemma 1).
In the following, we define the necessary semantic of FIX, โtentative resultโ, and โcorrect for a prefixโ, which allows us to establish the correctness of our greedy trial-and-error approach for the -lowest planes problem. Establishing runtime efficiency, with suitable data structures, is carried out in Lemmas 5, 6, and 7.
Definition 3 (Tentative Result, Prefix-Validity).
A sequence of triangles is called a tentative result for prefix , if and . Let denote the planes appearing in the tentative result.
A tentative result is valid for prefix , if -lowest-lowest.
Lemma 4 (FIX-Correctness).
Let be the triangle intersecting , and the smallest integer with SKIP.
Define FIX to return pair , such that triangle intersects and index is the smallest index with SKIP.
If is valid for prefix and , then is valid for prefix .
In particular, defined semantics for SKIP and FIX maintain the prefix-validity throughout any greedy-step of the query algorithm. That is, the final triangle sequence is valid for .
Proof.
The proof is by induction. The prefix invariant holds for for some , since the query algorithm always determines the intersected triangle in with minimal index in the BS partition as the first triangle in a tentative result. Let be the last triangle in the sequence that is valid for . Apply Lemma 2, and use that is minimal, and with , so true for .
Next, we discuss the algorithm for computing and its associated triangulation , including how the triangles are obtained for all possible integers , and the three kinds of planar point-location structures associated to that we will need to establish that and can be computed sufficiently fast during queries.
Lemma 5 (Construction).
There is an algorithm that computes a planar triangulation of projected ), where .
The triangulation has size , and is augmented with the structures:
-
1.
Global-Search: A point-location structure for determining a triangle .
-
2.
Samples: For each integer a subset of triangles, such that every connected component of has triangles, is adjacent to triangles from , and the separator contains triangles.
-
3.
Fix-Search: For each integer and each connected component of , a point-location structure for the triangles in that component.
-
4.
Fix-Pointer: For every and integer , pointers identifying the connected component of containing the corners of .
-
5.
Skip-Decider: For each and one point-location structure, for the overlay of , with worst-case query time .
Construction of these data structures takes time, they occupy space.
Proof.
We first assemble by merging the old prefix sets from the partition, drop all structures related to the old prefix sets, and then add all planes from the sampled triangles from higher indices to obtain the augmented set
Then we compute -level , project its faces into the plane, and compute its triangulation , which takes deterministic time, since .
We will show that the size of the augmented set remains of the same order , by showing that is sufficiently small in the following.
Samples.
The number of triangles in the triangulation is at most , i.e. bounding the nodes in its planar face-adjacency graph (cf. Sectionย 2). Next, we compute a triangle subset from the face-adjacency graph for each integer . That is, we compute in linear time a planar-separator such that each connected component of contains triangles, is adjacent to triangles from the separator, and contains a number of triangles that is at most . Note that invocations with are trivial, as this yields one connected component containing all nodes and empty separator . (E.g. any skip-range containing such an empty evaluates to False.)
To show the claimed , we first consider the right-most BS set (), where and holds.
Since , the number of planes in the down-samples at index distance is .
Thus, .
Using this, we have for , that . Thus, . Consequently,
That is, , as claimed.
The planar separator algorithm takes linear time for one execution, and is executed times. Thus computing the samples takes total time, also bounding the space for storing the obtained triangle subsets .
Global-Search.
Computing a planar point-location structure for triangulation takes time and occupies space.
Fix-Pointer.
For each corner of a and each integer , we perform a global search in to determine its containing triangle , and store the obtained connected component of in with corner . In case is a degenerate triangle, two of its boundaries are infinite rays in the plane. There we determine the component membership for the furthest points inside the ray. (Recall that any degenerate triangle is described by two points at infinity and one or two ordinary corner points, and that all standard planar point location structures naturally support queries for a point at infinity specified as ray.) As with a corner point, this also yields either a connected component or a triangle from separator . That is, every stores at most four pointers to connected components, and locating given point in takes time, and determining if found triangle is in the separator , or the connected component, also takes time. This takes total time and occupies space.
Fix-Search.
For each integer and each connected component of , we compute a point-location structure for the triangles in this connected component. This takes total time and occupies space.
Skip-Decider.
For every and skip-length , we compute the planar subdivision that is the overlay of the regions . Note that . The size is bounded by the number of vertices, so bounded by the total number of vertices in the given convex regions plus the total number of intersection points of edges from the given convex regions. We first bound the total size for fixed . For the first kind, the number of vertices, across all , is already bounded by due to the sampling bound above. For the second kind, we consider one . There, any hull edge can intersect only many edges from another convex hull, and there are many hulls to consider. Let be the complexity of the largest of these hulls within . Any of these hulls is composed of at most four sections of boundaries of connected-components, referenced by the fix-pointers of , note that has a worst-case bound of . (See Figureย 4.) Thus, the overlay within is a planar subdivision of size . Consequently, the total number of vertices of the second kind is bounded within an -factor of , where the latter sum is bounded by the number of vertices of the first kind. That is, the total size of all overlays for fixed is ; summing over shows that the total space is . With the space bound, it follows that the total construction time, for all and , is .
Next, we label each face, in the overlay for given and . We label (the interior of) each face with the largest integer so that its points are contained in each region . Taking a point within the face, we determine for if is contained in . This takes time for given point , as discussed for corner point component membership in above, and determining for thus takes time. Summing over , this is time. Thus, the total time to label each of the faces for all is 333This time bound here is the dominating factor in the construction time..
Finally, we compute a planar point-location structure for each labeled overlay, which retains the space bound and takes total time. For given and intersected by , the query time to report the largest integer that is contained in each hull is , as required.
It remains to show that the computed structures of allow us to compute and sufficiently fast for the outlined telescoping argument above.
Lemma 6 (SKIP-Runtime).
Let be the index where SKIP returns false. The structures stored with allow to answer the calls of SKIP in total time.
Proof.
Recall the construction of computed for each and integer query structures, that allow to answer if , and return the smallest integer of a where it is not contained. Answering a planar point-location query in the overlay for skip-length takes time. Consequently, answering such queries takes time using the skip-decider structures.
Lemma 7 (FIX-Runtime).
Finding the smallest integer where SKIP is false on prefix can be implemented in time. Moreover, obtaining the triangle that intersects takes time.
Proof.
Recall that Lemma 5 precomputed a point-location structure for the planar subdivision that is the overlay of the subdivisions in . As each region of that subdivision was labeled with the largest integer where its points are contained in all hull, we obtain the smallest in time , since . Recall that corner-component membership information was precomputed in construction of for all . For any given and connected component of , a point-location query takes time, and there are connected components to query.
Theorem 8.
Maintaining a query structure for a semi-dynamic set of planes under insertions such that for given vertical line we can report a sequence of at most triangles such that -lowest-lowest is possible with amortized insertion time. The structure has size .
The worst-case query time to obtain the triangle sequence is .
Proof.
Lemmas 2 and 4 showed that the triangle sequence has a set of planes with -lowest-lowest. The query time of follows from Lemmas 6 and 7 in the telescoping argument Eq. (1). The amortized update time of , follows from Lemma 5, showing a construction time of , where . From Lemma 5, space is dominated by the bound for , i.e. .
In Subsectionย 3.1, we introduce a Deduplication Lemma that enables us to apply known techniques for our efficient post-processing PRUNE of the triangle sequence.
3.1 PRUNE: Searching the k
-lists of triangles in time
This section capitalizes on the fact that the cardinality sets in our proposed structure are fixed at construction time. That is, we will augment each triangle , of any triangulation, with a static query structure that allows us to quickly retrieve the -lowest for desired granularity during the post-processing phase of the triangles.
Our main technical difficulty in obtaining the optimal query bound is avoiding duplicate entries in the sets of triangles in the sequence (), as the sets are, unlike the sets , not necessarily disjoint, preventing us direct access to the Heap-Selection method from [13]. To this end, we define the pruned set of a triangle to be
i.e. those planes in that do not appear by sampling in some with index .
Note that this definition does not involve query locations, i.e. we can build one static -lowest query structure for , and one for , during the construction of .
Lemma 9 (Deduplication).
Let be the union over the triangle sequence obtained by the query algorithm, , and from the leftmost triangle in the sequence.
Then, the sets are disjoint and the deduplicated sets have -lowest-lowest.
Proof.
Disjointness follows immediately from the definition. For the first triangle in the sequence . For triangles, we argue as follows.
For a contradiction, assume there is a plane -lowest-lowest, i.e. is contained in the -lowest on the original set but not in the deduplicated set.
Let index be minimal with (leftmost BS set), and intersecting .
There are two possible cases, may be present/absent in the triangle sequence.
If is present, we argue as follows. Since is a -lowest plane in the result, the triangle intersecting must contain . As is the left-most set containing , i.e. is minimal, we have that the plane must also be contained post-deduplication . So , and consequently -lowest, a contradiction.
Otherwise is absent in the triangle sequence generated by our query algorithm. For being absent, index must have been skipped by the query algorithm. Consider largest with that appears in the sequence. Indeed, exists, since cannot be the first triangle in the sequence. However, absent in the sequence requires that is in the region . By Lemma 2, -lowest-lowest. Thus -lowest must contain , contradicting is minimal.
Thus, our implementation of PRUNE uses static query structures obtained from a shallow-cutting hierarchy for the planes for , and a separate data structure for , for all and . Recall444See start of Sectionย 3 for discussion of related work [9]. that computing such a query structure takes near-linear time and space. This increases the time, and space, bound for our construction algorithm by no more than one factor (see proof of Lemma 5), thus giving a space and amortized insertion bound from Theorem 8. With those, querying any of the sets for the -lowest takes time.
With our Deduplication Lemma, the result follows immediately from the adaptation [13, Thm. 1] of the Heap-Selection algorithm [15], since we have structures over disjoint sets with query time each.
Corollary 10.
Increasing the space and amortized insertion bounds in Theorem 8 by one factor allows reporting the -lowest in time.
We conclude this section by presenting an alternative path to obtain the result, combining some basic ideas from [13, Thm. 1] with the, remarkable powerful, Soft-Heaps [10, 20] that are known to offer an alternative to Heap-Selection [18, Sec. 3].
Note that, for very small , we can just query the -lowest from each triangle and run the standard -Selection algorithm, taking time.
Simple queries with standard min-heaps
The following simplistic algorithm gives optimal query time for all .
We query lowest planes from each set, and insert all in a min-heap using the -coordinate of as key, i.e. we start on a min-heap with items. Then, we keep extracting the element with smallest key, until we extracted the -lowest globally. Whenever the elements from one set (of a in the sequence) were all extracted, we double that set size with a fresh query from and insert the new items of its larger batch into the heap, which takes time. This completes the description of the basic algorithm.
From the disjointness, we have that the planes from the final set are partitioned among the disjoint subsets of planes, that is there are integers with . Consequently, the total time for the iterated queries from , to obtain the replenishment items, remains . That is time overall to insert replenishment items. Since there are items in the heap throughout the processing, we have that each of the extract-min operations takes time. That is, the basic algorithm takes total time for initializing, inserting, and extracting.
The bottleneck for obtaining optimal bounds for larger is due to extractMin requiring time with standard heaps. (The planes are reported in sorted order.)
Soft-Heaps: Allowing Key-Corruption accelerates operations to .
4 Reducing Space to Linear
Lemma 11.
Space of the insertion-only -lowest structure can be reduced to linear , without increasing the query and update bounds.
Proof.
Since our approach uses , we can reduce our space bound to as follows.
We apply our proposed data structure (Theoremย 8 and Corollary 10) only to the set of planes from the first sets of the partition . Since , and , this set has planes; thus occupies space. For the last sets of the partition with , we use an optimal, static space structure from [9, 1] that allows reporting the -lowest planes in time. The expected construction time was made deterministic in [9].
To answer a query, we simply compute the -lowest in time, and the -lowest for each in the sets with . The resulting set contains planes, and we run the standard -Selection algorithm (see also Subsectionย 3.1) to obtain the -lowest planes in vertical query line , which takes time.
Corollary 12.
There exists a deterministic space data structure that answers -lowest planes queries in time and supports insertions in amortized time.
5 Applications
The applications stated in Sectionย 1 follow immediately by the standard paraboloid lifting of 2D points (-Nearest neighbor and circular range), or by the standard point-plane duality (vertical ray shooting and halfspace range reporting) and using iterated queries, with , for the -lowest planes from our proposed structure. (Applications 1-4.)
The only exception is the application 5, weighted halfspace range reporting. There we reduce the problem to two, one-sided queries. Our solution for the one-sided queries then observes that our proposed structure from Corollary 10 can be turned into a partially-persistent data structure with standard techniques (see Subsectionย 5.1).
Weighted halfspace range reporting.
The two-sided problem reduces to answering two one-sided queries, i.e. queries of the form . By inserting the elements with ascending weights into our proposed structure, the one-sided queries reduce to halfspace reporting among the -oldest elements of the insertion sequence, where is the number of elements with weight . The symmetric approach applies for one-sided queries of the form .
To reduce a two-sided query to two one-sided queries, we build a balanced, binary tree over the leaves, sorted by their weight . There we determine the successor of , called , and predecessor of , called . Let be the lowest common ancestor of and in the tree, and and be the left and right child of , respectively. Having precomputed a static structure for all elements within a subtree of a node, we can answer one one-sided reporting query in the structure of in time . Answering another one-sided reporting query in the structure of takes time . Since , the query time is .
It remains to obtain an query time for the -lowest, among the -oldest inserted planes, from our proposed structure.
5.1 Partial Persistence: Finding the -lowest among the -oldest planes
During the entire sequence of insertions , we keep track of the time, that is the number of insertions to the semi-dynamic set . Whenever the -th insertion, , triggers a rebuild of a prefix of Bentley-Saxe sets, we tag all structures that are dropped with timestamp and the newly created structure with timestamp .
Our extension to partial persistence is now to simply keep the obsolete data structures in memory, without deleting them. There are structures in total, and we store their intervals in a tree. To answer a query among the -oldest planes , we first determine those data-structures that are alive at time , i.e. have . Since the fix-pointers of our proposed data structure only refer to structures with higher indices (see proof of Lemma 5), we can simply run the greedy query algorithm on this set of data structures.
Since our structure has amortized insertion time, total space remains . Consequently, we can answer -lowest queries among any -oldest planes in time.
References
- [1] Peyman Afshani and Timothy M. Chan. Optimal halfspace range reporting in three dimensions. In 20th ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 180โ186, 2009. doi:10.1137/1.9781611973068.21.
- [2] Peyman Afshani, Yakov Nekrich, and Frank Staals. Convexity helps iterated search in 3d. In 41st International Symposium on Computational Geometry (SoCG), pages 3:1โ3:14, 2025. doi:10.4230/LIPIcs.SOCG.2025.3.
- [3] Pankaj K. Agarwal, Boris Aronov, Timothy M. Chan, and Micha Sharir. On Levels in Arrangements of Lines, Segments, Planes, and Triangles. Discret. Comput. Geom., 19(3):315โ331, 1998. doi:10.1007/PL00009348.
- [4] Jon Louis Bentley and James B. Saxe. Decomposable searching problems I: static-to-dynamic transformation. Journal of Algorithms, 1(4):301โ358, 1980. doi:10.1016/0196-6774(80)90015-2.
- [5] Timothy M. Chan. A dynamic data structure for 3-d convex hulls and 2-d nearest neighbor queries. Journal of the ACM, 57(3):16:1โ16:15, 2010. doi:10.1145/1706591.1706596.
- [6] Timothy M. Chan. Three problems about dynamic convex hulls. Int. J. Comput. Geom. Appl., 22(4):341โ364, 2012. doi:10.1142/S0218195912600096.
- [7] Timothy M. Chan. Dynamic geometric data structures via shallow cuttings. In 35th International Symposium on Computational Geometry (SoCG), pages 24:1โ24:13, 2019. doi:10.4230/LIPIcs.SOCG.2019.24.
- [8] Timothy M. Chan, Pingan Cheng, and Da Wei Zheng. An Optimal Algorithm for Higher-Order Voronoi Diagrams in the Plane: The Usefulness of Nondeterminism. In 35th ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 4451โ4463, 2024. doi:10.1137/1.9781611977912.156.
- [9] Timothy M. Chan and Konstantinos Tsakalidis. Optimal Deterministic Algorithms for 2-d and 3-d Shallow Cuttings. Discret. Comput. Geom., 56(4):866โ881, 2016. doi:10.1007/S00454-016-9784-4.
- [10] Bernard Chazelle. The soft heap: an approximate priority queue with optimal error rate. J. ACM, 47(6):1012โ1027, 2000. doi:10.1145/355541.355554.
- [11] Bernard Chazelle and Ding Liu. Lower bounds for intersection searching and fractional cascading in higher dimension. J. Comput. Syst. Sci., 68(2):269โ284, 2004. doi:10.1016/J.JCSS.2003.07.003.
- [12] Mark de Berg, Otfried Cheong, Marc J. van Kreveld, and Mark H. Overmars. Computational geometry: algorithms and applications, 3rd Edition. Springer, 2008. doi:10.1007/978-3-540-77974-2.
- [13] Sarita de Berg and Frank Staals. Dynamic data structures for k-nearest neighbor queries. Comput. Geom., 111:101976, 2023. doi:10.1016/J.COMGEO.2022.101976.
- [14] Jeff Erickson. Algorithms, 2019. URL: http://archive.org/details/Algorithms-Jeff-Erickson.
- [15] Greg N. Frederickson. An Optimal Algorithm for Selection in a Min-Heap. Inf. Comput., 104(2):197โ214, 1993. doi:10.1006/INCO.1993.1030.
- [16] Michael T. Goodrich. Planar Separators and Parallel Polygon Triangulation. J. Comput. Syst. Sci., 51(3):374โ389, 1995. doi:10.1006/JCSS.1995.1076.
- [17] John Iacono and Yakov Nekrich. Incremental Planar Nearest Neighbor Queries with Optimal Query Time. In 41st Symposium on Computational Geometry (SoCG), pages 59:1โ59:15, 2025. doi:10.4230/LIPIcs.SOCG.2025.59.
- [18] Haim Kaplan, Lรกszlรณ Kozma, Or Zamir, and Uri Zwick. Selection from Heaps, Row-Sorted Matrices, and X+Y Using Soft Heaps. In 2nd Symposium on Simplicity in Algorithms (SOSA), pages 5:1โ5:21, 2019. doi:10.4230/OASIcs.SOSA.2019.5.
- [19] Haim Kaplan, Wolfgang Mulzer, Liam Roditty, Paul Seiferth, and Micha Sharir. Dynamic planar voronoi diagrams for general distance functions and their algorithmic applications. In 28th ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2495โ2504, 2017. doi:10.1137/1.9781611974782.165.
- [20] Haim Kaplan and Uri Zwick. A simpler implementation and analysis of Chazelleโs soft heaps. In 20th ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 477โ485, 2009. doi:10.1137/1.9781611973068.53.
- [21] Philip N. Klein, Shay Mozes, and Christian Sommer. Structured recursive separator decompositions for planar graphs in linear time. In Symposium on Theory of Computing Conference (STOC), pages 505โ514, 2013. doi:10.1145/2488608.2488672.
- [22] Yakov Nekrich and Saladi Rahul. 4d range reporting in the pointer machine model in almost-optimal time. In 34th ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1862โ1876, 2023. doi:10.1137/1.9781611977554.CH71.
- [23] Micha Sharir, Shakhar Smorodinsky, and Gรกbor Tardos. An improved bound for k-sets in three dimensions. In 16th Symposium on Computational Geometry (SoCG), pages 43โ49, 2000. doi:10.1145/336154.336173.
Appendix A Proof of Lemma 1
Proof.
We consider the problem in the plane spanned by the segment and vertical line , thus containing as well. Any intersection of with is a line, as any does not contain vertical lines. Let be the intersection point of with its -lowest plane, and the intersection point of with its -lowest plane. That is, the orthogonal projection of is . (See Figureย 5.)
The proof is by contradiction. Assume there is a vertical line with that has a different set -lowest planes.
Let be one such plane not in . The projection of its intersection with is . Now, if intersects the downward vertical ray in we have a contradiction to , and the same argument applies to the ray in . So would need to contain a vertical line, which is not possible for any , or intersect more than once, which is also not possible for any line and segment pair.
