Abstract 1 Introduction 2 Technical Overview 3 Preliminaries 4 Offline dynamic maximum depth 5 Dynamic data structure for maximum depth 6 Adaptation to dynamic Klee’s measure 7 Conclusion and open questions References Appendix A Low-level implementation details Appendix B Missing proofs

Near-Optimal Dynamic Data Structures for Maximum Depth and Klee’s Measure of Boxes

Sujoy Bhore ORCID Indian Institute of Technology Bombay, Mumbai, India    Subhash Suri ORCID University of California, Santa Barbara, CA, USA    Jie Xue ORCID New York University Shanghai, China    Xiongxin Yang ORCID University of California, Santa Barbara, CA, USA    Jiumu Zhu ORCID New York University Shanghai, China
Abstract

We study two fundamental geometric problems on a dynamic set of n axis-parallel boxes in d-dimensional space. The maximum depth problem asks for the largest number of boxes that contain a common point, whereas Klee’s measure problem asks for the volume of the union of the boxes. We present fully dynamic exact data structures for both problems achieving O~⁢(n(d−1)/2) amortized update time. This update time is optimal for an exact dynamic algorithm, up to logarithmic factors, assuming the Combinatorial k-Clique Hypothesis. Previously, matching bounds were established only for d=1 [Imai and Asano, J. Algo.’83], and for d=2 [Suri, Xue, Yang, and Zhu, SoCG’25].

Our approach integrates a classic grid-based partition framework with a novel charging analysis that controls the cost of structure-sensitive offline routines within each cell. This argument allows us to perform a global aggregation of the update time, by circumventing the worst-case costs associated with individual cell updates. We believe this technique may be of independent interest for other dynamic geometric problems.

Keywords and phrases:
dynamic algorithms, maximum depth
Category:
Track A: Algorithms, Complexity and Games
Copyright and License:
[Uncaptioned image] © Sujoy Bhore, Subhash Suri, Jie Xue, Xiongxin Yang, and Jiumu Zhu; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation → Design and analysis of algorithms
Editors:
Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele Puppis

1 Introduction

For a set 𝒪 of geometric objects, the maximum depth of 𝒪 is the largest number of objects in 𝒪 that have a nonempty common intersection. Maximum depth is an important parameter capturing the local density of a family of geometric objects, and it has appeared in many geometric and combinatorial settings. The maximum depth is closely related to the clique number of the intersection graph of the objects. For example, for families with Helly number two – including axis-parallel rectangles and boxes – pairwise intersection implies a nonempty common intersection, and thus the maximum depth is exactly the size of a maximum clique in the corresponding intersection graph [19, 26]. For fat objects in fixed dimension, the maximum depth still provides a constant-factor approximation to the maximum clique size of the intersection graph.

Computing the maximum depth of an input family of objects in ℝd is a fundamental problem in computational geometry and has been studied since the early days of the field [24, 18, 4, 1, 3, 13, 30]. For (axis-parallel) boxes in ℝd, the maximum depth problem can be solved in O~⁢(nd/2) time [29, 12, 13]. This bound is believed to be tight up to logarithmic factors, since any improvement would break the Combinatorial k-Clique Hypothesis [12].

For boxes, a closely related problem is Klee’s measure: given a set ℬ of boxes, compute the volume of their union (the Klee’s measure of ℬ). The problem was first posed in 1977 by Klee [25], and it is among the earliest questions that influenced the development of computational geometry. Since then, it has been studied extensively [6, 31, 29, 12, 13, 5]. Moreover, algorithms for Klee’s measure can typically be adapted to solve the maximum depth problem with essentially the same running time [5]. In 1991, Overmars and Yap [29] gave the first O⁢(nd/2⁢log⁡n)-time algorithm for Klee’s measure in ℝd. About two decades later, Chan [12, 13] simplified and refined the approach to obtain an O⁢(nd/2)-time algorithm. Again, this bound is conditional tight up to logarithmic factors [12].

In this paper, we study the dynamic versions of the maximum depth problem and Klee’s measure problem for boxes in ℝd. In this fully dynamic setting, boxes may be inserted and deleted over time, and the goal is to maintain the maximum depth (respectively, Klee’s measure) of the current set efficiently. Since the seminal work of Overmars and van Leeuwen [28], dynamic geometric data structures have played a central role in computational geometry. Many classic geometric problems have been studied extensively in the dynamic model, leading to a rich collection of efficient data structures, including convex hulls [23, 10], closest pairs [20, 21, 14], range searching [27, 17], geometric width [11], geometric set cover and hitting set [15, 2, 16], geometric independent set [22, 9, 7], and geometric vertex cover and matching [8], among others. Due to the importance of maximum depth and Klee’s measure, it is natural to ask how efficiently one can maintain these quantities for a dynamic set of boxes in ℝd.

The near-optimal O~⁢(nd/2) running time for the static problems yields a lower bound for the dynamic setting via a standard sweep-line reduction: Given a dynamic data structure for maximum depth (or Klee’s measure) for boxes in ℝd with update time T⁢(n), one can obtain a static algorithm for boxes in ℝd+1 with running time O⁢(n⋅T⁢(n)) by applying the sweep-line framework of Imai and Asano [24]. Consequently, a dynamic data structure in ℝd with update time O⁢(n(d−1)/2−ε) would yield a static algorithm in ℝd+1 with running time O⁢(n(d+1)/2−ε). In light of this reduction, the most compelling goal is to design dynamic data structures whose update time matches the n(d−1)/2 barrier up to logarithmic factors. We formulate this as the following question, which is the main focus of this paper.

Do there exist dynamic data structures for maximum depth and Klee’s measure of
axis-parallel boxes in ℝd with update time O~⁢(n(d−1)/2)?

For d=1, the classic work of Imai and Asano [24] achieves O⁢(log⁡n) update time and thus answers the above question affirmatively. Beyond this base case, however, the question had remained poorly understood. Only very recently, Suri, Xue, Yang, and Zhu [30] proposed (among other results) a dynamic maximum-depth data structure for rectangles in the plane with O⁢(n1/2⁢log⁡n) amortized update time. With additional work, their ideas can be adapted to maintain Klee’s measure for planar rectangles as well, yielding O~⁢(n1/2) update time. This resolves the above question for d=2. Unfortunately, while the 2D framework [30] extends to higher dimensions, it does not achieve the target bound of O~⁢(n(d−1)/2), already for d=3 (see discussion in Section 2). Prior to this work, the above question was open for any value of d≥3.

The main contribution of this paper is to answer the question in the affirmative for every fixed d∈ℕ. Specifically, we design fully dynamic data structures for both maximum depth and Klee’s measure of axis-parallel boxes in ℝd with O~⁢(n(d−1)/2) update time.

Theorem 1.

There exists a fully dynamic maximum depth data structure for axis-parallel boxes in ℝd with O~⁢(n(d−1)/2) amortized update time.

Our techniques extend beyond depth queries and also yield an efficient dynamic structure for maintaining the union volume for boxes.

Theorem 2.

There exists a fully dynamic Klee’s measure data structure for axis-parallel boxes in ℝd with O~⁢(n(d−1)/2) amortized update time.

2 Technical Overview

We provide an overview of our fully dynamic maximum-depth data structure. We focus on the high-level ideas and the role of the key charging quantities. The dynamic Klee’s measure structure follows the similar framework with a different interval primitive.

2.1 Overview of the 2D data structure

We start by recalling the main idea behind the 2D data structure of [30]. It partitions the plane into r vertical strips so that each strip contains O⁢(n/r) rectangle corners, and maintains the maximum depth inside each strip separately. Although Ω⁢(n) rectangles may intersect a fixed strip, all but O⁢(n/r) of them have no corner in it; we call these rectangles good (for the strip), and the remaining O⁢(n/r) rectangles bad. Inside the strip, every good rectangle spans the strip in the x-direction and is therefore equivalent to an interval on the y-axis. This reduces the subproblem inside the strip to maintaining the maximum depth of a dynamic set of (weighted) intervals: updates caused by good rectangles take only O~⁢(1) time, while updates caused by bad rectangles take O~⁢(n/r) time, since there are only O⁢(n/r) bad rectangles whose contribution must be recomputed. Moreover, each rectangle is bad for only O⁢(1) strips (namely those containing its left or right vertical side), and is good for all other strips. Overall, the update time is O~⁢(r+n/r), which becomes O~⁢(n) by setting r=n.

2.2 Challenges in higher dimensions

A natural goal in ℝd is to replicate the same high-level principle: partition space so that most boxes behave “one-dimensionally” inside each region (and can be maintained cheaply), while only a small set of boxes interacts with the region boundaries. Two straightforward generalizations break down for essentially the same reason: the contribution of the boundary-interacting (“bad”) boxes can have prohibitively large combinatorial complexity. There are multiple natural generalizations of this approach to higher dimensions; however, none of them guarantees the desired bounds.

  • ■

    Partition into r slabs along one axis: Partition ℝd into r slab regions S1,…,Sr perpendicular to the x1-axis, each containing O⁢(n/r) box corners. Inside a slab Si, good boxes are those with no corner in Si; they span the slab in the x1-direction and thus reduce to (d−1)-dimensional boxes via projection. The difficulty is with the bad boxes: their contribution inside Si can be described by a piecewise-constant depth function over ℝd−1 whose rectilinear decomposition may require Ω⁢((n/r)d−1) regions in the worst case (because arrangements of t boxes in ℝd−1 can have complexity Ω⁢(td−1)). Thus, even assuming optimal lower-dimensional dynamic structures, the induced subproblem sizes are too large to support the target update time.

  • ■

    Partition into rd−𝟏 cells in the first d−𝟏 dimensions: Choose r−1 hyperplanes perpendicular to each of the first d−1 coordinate axes, so that these hyperplanes form a grid partition of ℝd into rd−1 cells, each of the form □×ℝ, where □⊆ℝd−1 is a (d−1)-dimensional axis-parallel box. Inside a fixed cell □×ℝ, a box is good if it spans the cell in the first d−1 coordinates, i.e., it completely covers □. Restricted to the cell, such a box contributes exactly one interval on the last axis and can be maintained with a dynamic maximum-depth data structure for intervals. The bottleneck is the remaining bad boxes, namely those that intersect □ but do not cover it, so some side facet of the box crosses the base □. A direct adaptation would handle these bad boxes in each affected cell by sweeping along the last axis and repeatedly invoking a (d−1)-dimensional dynamic maximum-depth subroutine. Even assuming optimal lower-dimensional update bounds, this becomes too expensive once summed over the Θ⁢(rd−2) cells whose bases can be intersected by the boundary of a single updated box.

2.3 Overview of Our Techniques

At a high-level, we also follow the grid partition into cells of the form □×ℝ, and we retain the same “good boxes ⇒ interval updates” principle. The key new ingredient is a structure-sensitive way to process the bad boxes within a fixed cell.

Fix a cell □⊆ℝd−1, and consider the set of bad boxes whose projections intersect □ but do not cover it. Our data structure represents their contribution to the depth inside □×ℝ by a piecewise-constant function on the last coordinate (equivalently, by a set of weighted (type-2) intervals, one per piece). Thus, for a cell □×ℝ, the total depth reduces to the maximum depth of a set of weighted intervals on the last axis: type-1 intervals coming from good boxes (weight 1) plus the type-2 intervals capturing the bad-box contribution.

The core task in an update is therefore the following: when the bad-box set for a cell changes, we must recompute the new inside-□ depth function (and hence the new set of type-2 intervals) efficiently. We accomplish this via an offline subroutine that further refines □ by inserting additional axis-parallel hyperplanes so that, inside every resulting subcell, each bad box becomes equivalent to a slab in ℝd−1 (i.e., it is bounded in exactly one of the first d−1 directions and is either fully present or fully absent in the other directions throughout the subcell). Once this holds, the contribution of the bad boxes inside each subcell reduces to a one-dimensional interval problem on the last axis.

The key idea to keep the refinement small is to avoid cutting at every bad-box endpoint in every partially overlapping direction. Instead, we choose an ordering (permutation) σ of the first d−1 coordinate axes. For a given bad box, we treat the earliest axis (in σ-order) along which it only partially overlaps □ as its active direction (the slab direction), and we cut at the box endpoints only in the later partially overlapping directions. Equivalently, the box charges every partially overlapping direction except its first one under σ. In the formal development, this choice is captured by the indicators ϕσ,□⁢(⋅,i) and the counts Φσ,□⁢(⋅,i)=1+∑ϕσ,□⁢(⋅,i). For a fixed σ, the number of inserted hyperplanes perpendicular to axis i is proportional to Φσ,□⁢(⋅,i)−1, and the number of resulting subcells is bounded by O⁢(∏iΦσ,□⁢(⋅,i)), which also governs the running time of the offline subroutine.

In the dynamic data structure, we maintain the values Φσ,□⁢(⋅,i) for every cell □, every axis i∈[d−1], and every permutation σ. When an update changes the bad-box set in a cell, we pick the permutation σ that minimizes the product bound ∏iΦσ,□⁢(⋅,i) and invoke the offline subroutine under this choice to compute the updated inside-□ depth function (and hence the new type-2 intervals) for that cell. Meanwhile, updates from good boxes remain fast interval insertions/deletions (type-1 updates).

The remaining challenge is to argue that the total cost of these offline computations over all cells affected by a single box update is bounded by O~⁢(n(d−1)/2). This is where the main charging analysis enters. The affected cells lie on O⁢(d) “slices” of the grid determined by the facets of the projected box: fixing a coordinate t∈[d−1] and a slab index a∈[r] specifies a family of cells Vt⁢(a). A global charging argument relates each local quantity Φσ,□v⁢(⋅,i) to the distribution of box corners among these slices and shows that, for any slice Vt⁢(a), choosing an order σ whose first element is t yields a strong bound on ∑□∈Vt⁢(a)∏iΦσ,□⁢(⋅,i) (Lemma 11). Combining this with the fact that each affected cell contains only O⁢(n/r) bad boxes yields the desired amortized update time after setting r=n.

3 Preliminaries

Basic Notations.

We use ℕ to denote the set of positive integers and define ℕ0=ℕ∪{0}. For an integer n∈ℕ, we write [n]={1,…,n}. Throughout the paper, all rectangles and boxes are axis-parallel.

Projection.

Let B=∏i=1d[xi−,xi+] be a box in ℝd. For i∈[d], let 𝐩𝐫𝐨𝐣i⁢(B):=[xi−,xi+] denote the interval obtained by projecting B onto dimension i. More generally, for I={i1,…,ik}⊆[d] where i1<⋯<ik, let 𝐩𝐫𝐨𝐣I⁢(B):=∏j=1k[xij−,xij+] denote the |I|-dimensional box obtained by projecting B onto the dimensions in I. For a set ℬ of boxes in ℝd, we write 𝐩𝐫𝐨𝐣i⁢(ℬ)={𝐩𝐫𝐨𝐣i⁢(B):B∈ℬ} for i∈[d] and 𝐩𝐫𝐨𝐣I⁢(ℬ)={𝐩𝐫𝐨𝐣I⁢(B):B∈ℬ} for I⊆[d].

Maximum depth.

Let 𝒪 be a set of geometric objects in ℝd. For a point p∈ℝd, we define 𝖽𝖾𝗉p⁢(𝒪)=|{O∈𝒪:p∈O}|, which is called the depth of 𝒪 at p. For a region R⊆ℝd, we define 𝖽𝖾𝗉R⁢(𝒪)=supp∈R𝖽𝖾𝗉p⁢(𝒪), which is called the maximum depth of 𝒪 inside R. We write 𝖽𝖾𝗉⁢(𝒪)=𝖽𝖾𝗉ℝd⁢(𝒪) for the maximum depth of 𝒪.

Klee’s measure.

For a geometric object O in ℝd, we denote by V⁢(O) the volume of O. Let 𝒪 be a set of geometric objects in ℝd. For a region R⊆ℝd, we define 𝖪𝗅𝖾𝖾R⁢(𝒪)=V⁢((⋃O∈𝒪O)∩R), which is called the Klee’s measure of 𝒪 inside R. We write 𝖪𝗅𝖾𝖾⁢(𝒪)=𝖪𝗅𝖾𝖾ℝd⁢(𝒪) for the Klee’s measure of 𝒪. Note that 𝖪𝗅𝖾𝖾⁢(𝒪) can be ∞ if 𝒪 contains unbounded objects.

Piecewise constant functions.

We say that a function f:ℝ→ℝ is piecewise constant if ℝ can be partitioned into finitely many intervals I1,…,Ir such that, for every i∈[r], the restriction f|Ii is constant. Such a partition need not be unique. If we require r to be minimum possible, then the resulting partition into maximal intervals on which f is constant is uniquely determined; we call these intervals the pieces of f and denote them by I1∗,…,Ir∗. For each piece Ii∗, we write f⁢(Ii∗)=f⁢(x) for an arbitrary x∈Ii∗; this value is well-defined since f|Ii∗ is constant.

4 Offline dynamic maximum depth

In this section, we consider an offline variant of the dynamic maximum depth problem and propose an algorithm whose running time depends not only on the number of update operations but also on the structure of the boxes involved. We will use this offline algorithm as a subroutine in our fully dynamic data structure.

Offline Inside-R Box Maximum Depth in ℝc

Input: An initially empty set ℬ of boxes in ℝc, a fixed box region R⊆ℝc, and a sequence of n updates to ℬ, each of which is of one of the following two types:

  • ■

    Insertion: Insert a new box into ℬ.

  • ■

    Deletion: Delete an existing box from ℬ

Output: A sequence (δ1,…,δn), where δi∈ℕ0 is the maximum depth of ℬ inside the region R after the i-th update.

4.1 Dynamic maximum depth for slabs

In designing our algorithm, we require an efficient dynamic maximum-depth data structure for slabs, i.e., boxes that are bounded in exactly one dimension. Formally, a slab L in ℝc is a box such that there exists exactly one index i∈[c] satisfying 𝐩𝐫𝐨𝐣i⁢(L)≠(−∞,∞).

If we have a dynamic set ℒ of slabs in ℝc that are all bounded in the same dimension, then maintaining the maximum depth of ℒ reduces to maintaining the maximum depth of a dynamic set of intervals and can be done with logarithmic update time. Moreover, the following observation implies that even if the slabs in ℒ are bounded in different dimensions, we can still maintain the maximum depth of ℒ with logarithmic update time by handling each dimension separately.

Fact 3.

Let ℒ be a set of slabs in ℝc and □ be a fixed box in ℝc. Then we have 𝖽𝖾𝗉□⁢(ℒ)=∑i=1c𝖽𝖾𝗉□⁢(ℒi), where ℒi⊆ℒ consists of the slabs bounded in dimension i.

Proof.

Since ℒ=⋃i=1cℒi, we have 𝖽𝖾𝗉□⁢(ℒ)≤∑i=1c𝖽𝖾𝗉□⁢(ℒi). It remains to show the reverse inequality. For each i∈[c], let pi∈□ be a point satisfying 𝖽𝖾𝗉pi⁢(ℒi)=𝖽𝖾𝗉□⁢(ℒi). Since all slabs in ℒi are perpendicular to the xi-axis, we have 𝖽𝖾𝗉p⁢(ℒi)=𝖽𝖾𝗉pi⁢(ℒi) for any point p∈ℝc whose i-th coordinate is equal to that of pi. Let p∗ denote the point whose i-th coordinate equals the i-th coordinate of pi for every i∈[c]. Then 𝖽𝖾𝗉p∗⁢(ℒi)=𝖽𝖾𝗉pi⁢(ℒi) for all i∈[c], and thus

𝖽𝖾𝗉p∗⁢(ℒ)=∑i=1c𝖽𝖾𝗉p∗⁢(ℒi)=∑i=1c𝖽𝖾𝗉pi⁢(ℒi)=∑i=1c𝖽𝖾𝗉□⁢(ℒi).

Moreover, p∗∈□ since p1,…,pc∈□. Therefore, 𝖽𝖾𝗉□⁢(ℒ)≥𝖽𝖾𝗉p∗⁢(ℒ)=∑i=1c𝖽𝖾𝗉□⁢(ℒi). ◀

Figure 1: Illustration of Fact 3 in 2D. Blue (resp. yellow) rectangles represent horizontal (resp. vertical) slabs, with p1 (resp. p2) achieving maximum depth. The point p achieves maximum depth with respect to all slabs.
Lemma 4.

Let □ be a fixed box in ℝc. There exists a dynamic inside-□ maximum depth data structure for slabs in ℝc with O⁢(log⁡n) update time.

Proof.

Let ℒ be a dynamic set of slabs in ℝc, and for each i∈[c] let ℒi⊆ℒ denote the slabs perpendicular to the xi-axis. For each i∈[c], we maintain a data structure 𝐃i that supports updates to ℒi and maintains 𝖽𝖾𝗉□⁢(ℒi). Maintaining 𝖽𝖾𝗉□⁢(ℒi) reduces to the one-dimensional problem of maintaining the maximum depth of the dynamic interval set 𝐩𝐫𝐨𝐣i⁢(ℒi) inside the interval 𝐩𝐫𝐨𝐣i⁢(□), which admits O⁢(log⁡n) update time [24]. An insertion or deletion of a slab affects exactly one index i, and thus triggers a single update to the corresponding 𝐃i. Therefore, by Fact 3, 𝐃1,…,𝐃c together maintain 𝖽𝖾𝗉□⁢(ℒ). The update time is O⁢(log⁡n). ◀

4.2 Solving the offline problem

Let □ be a box in ℝc. We say a box B in ℝc is nontrivial in dimension i∈[c] with respect to □ if 𝐩𝐫𝐨𝐣i⁢(□)∩𝐩𝐫𝐨𝐣i⁢(B)≠∅ and 𝐩𝐫𝐨𝐣i⁢(□)⊈𝐩𝐫𝐨𝐣i⁢(B). For a permutation σ of [c], an index i∈[c], and a box B in ℝc, we define ϕσ,□⁢(B,i)=1 if both of the following conditions hold:

  • ■

    B is nontrivial in dimension i with respect to □,

  • ■

    there exists j<σi such that B is nontrivial in dimension j with respect to □.

Otherwise, ϕσ,□⁢(B,i)=0. For a set ℬ of boxes in ℝc, define Φσ,□⁢(ℬ,i)=1+∑B∈ℬϕσ,□⁢(B,i).

Lemma 5.

Let σ be a permutation of [c] and □ be a fixed box in ℝc. Then Offline Inside-□ Box Maximum Depth in ℝc can be solved in O⁢(n⁢log⁡n⋅∏i=1cΦσ,□⁢(ℬ∗,i)) time, where ℬ∗ denotes the set of all boxes that are inserted into ℬ in the sequence of updates.

Proof.

For simplicity, we present the proof for the case □=ℝc and drop the subscript □ in the notation. the argument extends verbatim to an arbitrary fixed box □ by restricting attention to □. Without loss of generality, we assume the boxes in ℬ∗ are in general position in the sense that, for every i∈[c], the intervals in 𝐩𝐫𝐨𝐣i⁢(ℬ∗) have distinct endpoints.

For each i∈[c], we define a set ℋi of hyperplanes perpendicular to the xi-axis as follows. Let ℬi∗={B∈ℬ∗:ϕσ⁢(B,i)=1}. For each endpoint a∈ℝ of each interval in 𝐩𝐫𝐨𝐣i⁢(ℬi∗), we include in ℋi the hyperplane xi=a. Note that |ℋi|=2⁢|ℬi∗|=2⋅∑B∈ℬ∗ϕσ⁢(B,i). The hyperplanes in ℋ1,…,ℋc partition the space ℝc into ∏i=1c(|ℋi|+1)=O⁢(∏i=1cΦσ⁢(ℬ∗,i)) cells; let Γ denote the resulting set of cells. For each cell γ∈Γ, we maintain a dynamic data structure 𝐃γ that maintains the maximum depth of the current set ℬ inside the interior of γ; denote this value by yγ. Under the general-position assumption, the maximum depth of ℬ is attained in the interior of some cell, and thus equals maxγ∈Γ⁡yγ. Therefore, replaying the n updates for every γ∈Γ yields a total running time O⁢(|Γ|⋅n⋅t), where t is the maximum update time of each individual 𝐃γ.

The remaining task is to achieve t=O⁢(log⁡n). The key observation is that, inside the interior of any fixed cell γ∈Γ, every box B∈ℬ∗ behaves like a slab. To see this, fix B∈ℬ∗ and suppose B is nontrivial in dimensions i1,…,ip∈[c] with respect to ℝc, where i1<σ⋯<σip. By the definition of ϕ, we have ϕσ⁢(B,i2)=⋯=ϕσ⁢(B,ip)=1. Hence, for each j∈{2,…,p}, we added to ℋij the two hyperplanes corresponding to the endpoints of 𝐩𝐫𝐨𝐣ij⁢(B). It follows that, for each such j, the interior of 𝐩𝐫𝐨𝐣ij⁢(γ) is either contained in 𝐩𝐫𝐨𝐣ij⁢(B) or disjoint from it. Therefore, inside the interior of γ, the box B has the same intersection as the slab ∏i=1i1−1(−∞,∞)×𝐩𝐫𝐨𝐣i1⁢(B)×∏i=i1+1c(−∞,∞). As a consequence, inside the interior of γ, maintaining the maximum depth of ℬ reduces to maintaining the maximum depth of a dynamic set of slabs. We can therefore instantiate 𝐃γ using Lemma 4, which supports updates in O⁢(log⁡n) time. This gives t=O⁢(log⁡|ℬ∗|)=O⁢(log⁡n) and yields a total running time as claimed. ◀

Let R be a region in ℝd−1 and let ℬ be a set of boxes in ℝd. We define the inside-R depth function of ℬ as the function δRℬ:ℝ→ℕ0 given by δRℬ⁢(p):=𝖽𝖾𝗉R×{p}⁢(ℬ) for all p∈ℝ. Note that δRℬ is a piecewise constant function, for any choice of R. Indeed, as p moves from −∞ to ∞, the set of boxes intersecting the slice R×{p} can change only when p reaches an endpoint of an interval in 𝐩𝐫𝐨𝐣d⁢(ℬ). Our offline algorithm above directly implies an algorithm for computing the inside-□ depth function for a fixed box □, which will be used in our dynamic data structure.

Refer to caption
Refer to caption
Figure 2: A cell γ∈Γ (gray) that unbounded along one axis and its top-view. By the auxiliary partitions, all boxes intersecting γ are slabs. Colors indicate the bounded direction (yellow vs. blue). The cross-section induced by the red hyperplane yields a 2D instance of horizontal and vertical slabs as in Figure 1.
Corollary 6.

Given a permutation σ of [d−1], a box □ in ℝd−1, and a set ℬ of n boxes in ℝd, one can compute the inside-□ depth function δ□ℬ:ℝ→ℕ0 in O⁢(n⁢log⁡n⋅∏i=1d−1Φσ,□⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i)) time.

Proof.

Let P be the set of endpoints of the intervals in 𝐩𝐫𝐨𝐣d⁢(ℬ). Without loss of generality, assume that the boxes in ℬ are in general position, so P contains exactly 2⁢n distinct points p1,…,p2⁢n with p1<⋯<p2⁢n. Consider a point q∈ℝ moving from −∞ to ∞ on xd-axis, and maintain a dynamic set ℬ0 of boxes in ℝd−1, initially empty. Whenever q reaches a point pi, if pi is the left (resp., right) endpoint of 𝐩𝐫𝐨𝐣d⁢(B) for some B∈ℬ, then we insert into ℬ0 (resp., delete from ℬ0) the box 𝐩𝐫𝐨𝐣[d−1]⁢(B). Clearly, for any a∈ℝ, δ□ℬ⁢(a) equals the maximum depth of ℬ0 inside □ at the time q=a. Thus, to compute δ□ℬ, it suffices to maintain the maximum depth of ℬ0 inside □ under this sequence of insertions and deletions. This is an instance of Offline Inside-□ Box Maximum Depth in ℝd−1, as the update sequence is fully known in advance. Moreover, the set of boxes that are ever inserted into ℬ0 is exactly 𝐩𝐫𝐨𝐣[d−1]⁢(ℬ). Applying Lemma 5 completes the proof and yields the stated running time O⁢(n⁢log⁡n⋅∏i=1d−1Φσ,□⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i)). ◀

5 Dynamic data structure for maximum depth

We now describe our dynamic data structure for maintaining the maximum depth of a dynamic set of boxes. Let ℬ be a dynamic set of boxes in ℝd, which contains n boxes initially. Let r be a parameter to be specified later.

5.1 Construction of the data structure

In the preprocessing, for each dimension i∈[d−1], we construct a set ℋi of r−1 hyperplanes in ℝd perpendicular to the xi-axis such that, after sorting the hyperplanes along the xi-axis, the number of corners of boxes in ℬ lying between any two consecutive hyperplanes is O⁢(n/r). Let ℋ:=⋃i=1d−1ℋi. The hyperplanes in ℋ partition ℝd into rd−1 regions, which we call cells. We index cells by vectors v→=(a1,…,ad−1)∈[r]d−1, where ai indicates the position of the cell along dimension i (i.e., the cell lies between the (ai−1)-st and ai-th hyperplanes in ℋi, with the two outermost slabs treated as unbounded). Since we do not introduce hyperplanes perpendicular to the xd-axis, each cell is of the form □×ℝ for a box □⊆ℝd−1. For each v→∈[r]d−1, let □v→ denote the unique box in ℝd−1 such that the corresponding cell is □v→×ℝ.

By the standard periodic reconstruction trick, we may assume that |ℬ|=Θ⁢(n) throughout the reconstruction period. For simplicity, we also assume that, throughout the period, for each i∈[d−1], the number of corners of boxes in ℬ between any two consecutive hyperplanes in ℋi remains O⁢(n/r). This assumption can be removed by applying the same splitting procedure as in [30]; we defer these implementation details to Appendix A.

For each v→∈[r]d−1, our data structure maintains the following information:

  • ■

    Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i) for all permutations σ of [d−1] and all i∈[d−1].

  • ■

    The subset ℬv→:={B∈ℬ:□v→∩𝐩𝐫𝐨𝐣[d−1]⁢(B)≠∅⁢ and ⁢□v→⊈𝐩𝐫𝐨𝐣[d−1]⁢(B)}⊆ℬ.

  • ■

    A dynamic maximum-depth data structure 𝐃v→ for weighted intervals, storing a multiset ℐv→ that consists of:

    • –

      the interval 𝐩𝐫𝐨𝐣d⁢(B) with weight 1, for every B∈ℬ with □v→⊆𝐩𝐫𝐨𝐣[d−1]⁢(B); these are called type-1 intervals,

    • –

      the interval P with weight δ□v→ℬv→⁢(P), for every piece P of the function δ□v→ℬv→; these are called type-2 intervals.

The basic correspondence between ℐv→ and the inside-□v→ depth function is easy to establish.

Observation 7.

𝖽𝖾𝗉p⁢(ℐv→)=δ□v→ℬ⁢(p) for all p∈ℝ.

Proof.

Fix p∈ℝ. By construction, 𝖽𝖾𝗉p⁢(ℐv→) equals δ□v→ℬv→⁢(p) plus the number of boxes B∈ℬ satisfying □v→⊆𝐩𝐫𝐨𝐣[d−1]⁢(B) and p∈𝐩𝐫𝐨𝐣d⁢(B). The latter quantity is exactly δ□v→ℬ∖ℬv→⁢(p). Therefore, 𝖽𝖾𝗉p⁢(ℐv→)=δ□v→ℬv→⁢(p)+δ□v→ℬ∖ℬv→⁢(p)=δ□v→ℬ⁢(p). ◀ The intervals in ℐv→ are stored in the data structure 𝐃v→ for weighted intervals. Observation 7 implies that 𝖽𝖾𝗉⁢(ℐv→)=𝖽𝖾𝗉□v→×ℝ⁢(ℬ), and hence maxv→∈[r]d−1⁡𝖽𝖾𝗉⁢(ℐv→)=𝖽𝖾𝗉⁢(ℬ). Accordingly, maintaining the values 𝖽𝖾𝗉⁢(ℐv→) and taking their maximum over all v→∈[r]d−1 suffices to obtain 𝖽𝖾𝗉⁢(ℬ).

Consider an update on a box B that either inserts B into ℬ or deletes an existing box B∈ℬ. We process the update for every v→∈[r]d−1. First, we update the values Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i) for all permutations σ of [d−1] and all i∈[d−1]. This is straightforward: for each such pair (σ,i), we compute ϕσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(B),i) and either add it to or subtract it from the current value of Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i), depending on whether the update is an insertion or a deletion. We then update the set ℬv→, which is also immediate from its definition.

Next, we update the data structure 𝐃v→, since the interval multiset ℐv→ may change. There are three cases. If □v→∩𝐩𝐫𝐨𝐣[d−1]⁢(B)=∅, then ℐv→ does not change. If □v→⊆𝐩𝐫𝐨𝐣[d−1]⁢(B), then ℐv→ changes only by a single type-1 interval: we insert 𝐩𝐫𝐨𝐣d⁢(B) (with weight 1) if B is inserted, or delete the corresponding type-1 interval if B is deleted. Thus, it suffices to perform one insertion/deletion operation in 𝐃v→.

In the remaining case, we have □v→∩𝐩𝐫𝐨𝐣[d−1]⁢(B)≠∅ and □v→⊈𝐩𝐫𝐨𝐣[d−1]⁢(B), i.e., B∈ℬv→. In this case, the type-2 intervals in ℐv→ change, and we proceed as follows.

  1. 1.

    Pick a permutation σ of [d−1] that minimizes ∏i=1d−1Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i).

  2. 2.

    Apply the algorithm of Corollary 6 with this permutation σ to compute the updated inside-□v→ depth function δ□v→ℬv→, which in turn specifies the updated set of type-2 intervals in ℐv→.

  3. 3.

    Delete the old type-2 intervals from 𝐃v→ and insert the new type-2 intervals into 𝐃v→.

We perform the above update for all v→∈[r]d−1. Correctness follows from Observation 7 and the fact that 𝐃v→ always stores exactly the current interval multiset ℐv→. The main challenge is to prove that this procedure achieves the desired amortized update time O~⁢(n(d−1)/2).

5.2 Update time analysis

We show that each update of our data structure can be processed in O~⁢((n/r)d−1+rd−1) time. Setting r=n then yields the desired bound O~⁢(n(d−1)/2).

Consider an update that inserts a new box B∗ or deletes an existing box B∗. First observe that, for every v→∈[r]d−1 such that ℬv→ does not change, the corresponding local update costs only O~⁢(1) time (it consists of maintaining counters and possibly inserting/deleting a single type-1 interval). In total, this contributes O~⁢(rd−1) time. It therefore suffices to focus on those v→∈[r]d−1 for which ℬv→ changes; let V∗⊆[r]d−1 denote this set. Note that V∗ consists exactly of the vectors v→ for which □v→ intersects the boundary of 𝐩𝐫𝐨𝐣[d−1]⁢(B∗). For v→∈V∗, all steps of the update can still be performed in O~⁢(1) time except: (i) recomputing δ□v→ℬv→ via Corollary 6, and (ii) deleting the old type-2 intervals from 𝐃v→ and inserting the new ones. Since δ□v→ℬv→ has O⁢(|ℬv→|) pieces, step (ii) costs O~⁢(|ℬv→|) time, which is dominated (up to logarithmic factors) by the cost of step (i). Thus, it suffices to bound the total cost of computing δ□v→ℬv→ for all v→∈V∗.

Let ℬ denote the set of boxes after the insertion/deletion of B∗. For i∈[d−1] and a∈[r], define

Vi⁢(a):={(a1,…,ad−1)∈[r]d−1:ai=a}.

Intuitively, the cells □v→×ℝ with v→∈Vi⁢(a) are precisely those whose i-th coordinate is a. Define γi⁢(a):=∑v→∈Vi⁢(a)|𝖼𝗈𝗋⁢(ℬ)∩(□v→×ℝ)|, i.e., the number of corners of boxes in ℬ lying in these cells. For i,j∈[d−1] and a,b∈[r], define Vi,j⁢(a,b) and γi,j⁢(a,b) similarly. The following basic properties are immediate from the construction.

Fact 8.

The following three properties hold.

  1. (i)

    γi⁢(a)=O⁢(n/r) for all i∈[d−1] and a∈[r].

  2. (ii)

    ∑a=1rγi,j⁢(a,b)=γj⁢(b) for all i,j∈[d−1] and b∈[r].

  3. (iii)

    For v→=(a1,…,ad−1)∈[r]d−1, |ℬv→|≤∑i=1d−1γi⁢(ai).

Combining Item 1 and Item 3 yields |ℬv→|=O⁢(n/r) for all v→∈[r]d−1, and in particular for all v→∈V∗. By Corollary 6, computing δ□v→ℬv→ takes time

O⁢(|ℬv→|⁢log⁡|ℬv→|⋅minσ⁢∏i=1d−1Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬv→),i)),

where the minimum is over permutations σ of [d−1]. Thus, the remaining difficulty is to bound the multiplicative factor minσ⁢∏i=1d−1Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬv→),i) in aggregate over v→∈V∗. A per-cell bound is too weak; instead we carry out a global analysis. The key is Lemma 11, which is based on the following relation between the Φ-values and the γ-values.

Lemma 9.

Let v→=(a1,…,ad−1)∈[r]d−1 and σ be a permutation of [d−1]. Then for any box B in ℝd and any i∈[d−1], if ϕσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(B),i)=1, then there exist j∈[d−1] with j<σi and a vector u→∈Vi,j⁢(ai,aj) satisfying that 𝖼𝗈𝗋⁢(B)∩(□u→×ℝ)≠∅.

Proof.

Assume ϕσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(B),i)=1. By definition of ϕ, 𝐩𝐫𝐨𝐣[d−1]⁢(B) is nontrivial in dimension i with respect to □v→, and there exists j<σi such that 𝐩𝐫𝐨𝐣[d−1]⁢(B) is also nontrivial in dimension j with respect to □v→. Therefore, there is a facet Fi (resp., Fj) of 𝐩𝐫𝐨𝐣[d−1]⁢(B) perpendicular to the xi-axis (resp., xj-axis) that intersects □v→. Let Fi′ and Fj′ be the corresponding facets of B. Then both Fi′ and Fj′ intersect the cell □v→×ℝ. Since i≠j, there is a corner z∈𝖼𝗈𝗋⁢(B) lying on both Fi′ and Fj′. Suppose z∈□u→×ℝ for u→=(b1,…,bd−1)∈[r]d−1. Then 𝖼𝗈𝗋⁢(B)∩(□u→×ℝ)≠∅. Moreover, because z∈Fi′ and Fi′ is perpendicular to the xi-axis while intersecting □v→×ℝ, the i-th coordinate slab of z equals that of □v→×ℝ, i.e., bi=ai. Similarly, bj=aj. Hence u→∈Vi,j⁢(ai,aj). ◀

Corollary 10.

Let v→=(a1,…,ad−1)∈[r]d−1 and σ be a permutation of [d−1]. Then for any i∈[d−1], we have the inequality

Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i)−1≤∑j∈[d−1],j<σiγi,j⁢(ai,aj).
Proof.

By definition, Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i)−1=∑B∈ℬϕσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(B),i). For a B∈ℬ such that ϕσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(B),i)=1, Lemma 9 implies that there exists j<σi and some u→∈Vi,j⁢(ai,aj) such that 𝖼𝗈𝗋⁢(B)∩(□u→×ℝ)≠∅. Consequently,

ϕσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(B),i)≤∑j∈[d−1],j<σi∑u→∈Vi,j⁢(ai,aj)|𝖼𝗈𝗋⁢(B)∩(□u→×ℝ)|.

Summing this inequality over all B∈ℬ yields

Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i)−1 ≤∑B∈ℬ∑j∈[d−1],j<σi∑u→∈Vi,j⁢(ai,aj)|𝖼𝗈𝗋⁢(B)∩(□u→×ℝ)|
=∑j∈[d−1],j<σi∑u→∈Vi,j⁢(ai,aj)|𝖼𝗈𝗋⁢(ℬ)∩(□u→×ℝ)|
=∑j∈[d−1],j<σiγi,j⁢(ai,aj).

◀

We are now ready to prove the key lemma. Roughly speaking, it bounds the total “Φ-product complexity” over all cells in a fixed tube Vt⁢(a), provided the permutation σ starts with t.

Lemma 11.

Let t∈[d−1] and a∈[r]. If σ is a permutation of [d−1] whose first element is t, then we have ∑v→∈Vt⁢(a)∏i=1d−1Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬv→),i)=O⁢((n/r+r)d−2).

Proof.

It suffices to prove ∑v→∈Vt⁢(a)∏i=1d−1Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i)=O⁢((n/r+r)d−2). Without loss of generality, assume t=1 and σ=(1,…,d−1). Then Vt⁢(a) consists of the vectors (a1,…,ad−1)∈[r]d−1 with a1=a and a2,…,ad−1∈[r]. By Corollary 10,

∑v→∈Vt⁢(a)∏i=1d−1Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i) ≤∑a1=aa∑a2=1r⋯⁢∑ad−1=1r∏i=1d−1(1+∑j=1i−1γi,j⁢(ai,aj))
≤∑a1=aa∑a2=1r⋯⁢∑ad−1=1r∏i=2d−1(∑j=1i−1(γi,j⁢(ai,aj)+1)).

Define Q:={(j2,…,jd−1)∈[d−1]d−2:ji<i⁢ for all ⁢i∈{2,…,d−1}}. Then in the above inequality, ∏i=2d−1(∑j=1i−1(γi,j⁢(ai,aj)+1))=∑(j2,…,jd−1)∈Q∏i=2d−1(γi,ji⁢(ai,aji)+1), and therefore
∑v→∈Vt⁢(a)∏i=1d−1Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i) ≤∑(j2,…,jd−1)∈Q∑a1=aa∑a2=1r⋯⁢∑ad−1=1r∏i=2d−1(γi,ji⁢(ai,aji)+1).

Since |Q|=O⁢(1) (as d is constant), it suffices to show that for every fixed (j2,…,jd−1)∈Q, the left sum-of-products is bounded by O⁢((n/r+r)d−2). For each k∈[d−1], define

Sk:=∑a1=aa∑a2=1r⋯⁢∑ak=1r∏i=2k(γi,ji⁢(ai,aji)+1).

This is well-defined because ji<i for all i, and thus all indices appearing in the product are at most k−1. We prove by induction that Sk=O⁢((n/r+r)k−1) for all k∈[d−1], which immediately gives the desired bound for Sd−1=O⁢((n/r+r)d−2).

For the base case k=1, we have S1=∑a1=aa∏i=21γi,ji′⁢(ai,aji)=O⁢(1). Assume Sk−1=O⁢((n/r+r)k−2) for some k≥2. In the product ∏i=2k(γi,ji⁢(ai,aji)+1), all factors with i≤k−1 are independent of ak, since ji<i≤k−1. Hence,

Sk =∑a1=aa∑a2=1r⋯⁢∑ak−1=1r(∏i=2k−1(γi,ji⁢(ai,aji)+1)⋅∑ak=1r(γk,jk⁢(ak,ajk)+1))
=∑a1=aa∑a2=1r⋯⁢∑ak−1=1r(∏i=2k−1(γi,ji⁢(ai,aji)+1)⋅(r+∑ak=1rγk,jk⁢(ak,ajk))).

By Item 2 of Fact 8, ∑ak=1rγk,jk⁢(ak,ajk)=γjk⁢(ajk), and by Item 1 of Fact 8 this is O⁢(n/r) for every value of ajk. Therefore,

Sk=O⁢(n/r+r)⋅∑a1=aa∑a2=1r⋯⁢∑ak−1=1r∏i=2k−1(γi,ji⁢(ai,aji)+1)=O⁢((n/r+r)⋅Sk−1),

which yields Sk=O⁢((n/r+r)k−1) and completes the proof. ◀

Corollary 12.

∑v→∈V∗Tv→=O~⁢((n/r)d−1+n⁢rd−3), where Tv→ denotes the time cost of computing δ□v→ℬv→.

Proof.

Recall that V∗ consists of all v→∈[r]d−1 such that □v→ intersects the boundary of 𝐩𝐫𝐨𝐣[d−1]⁢(B∗). Equivalently, □v→ intersects one of the 2⁢(d−1) facets of 𝐩𝐫𝐨𝐣[d−1]⁢(B∗). Let F1,…,Fd−1,F1′,…,Fd−1′ be these facets, where Fi,Fi′ are perpendicular to the xi-axis. For each i∈[d−1], there exist indices ai,ai′∈[r] such that Fi⊆⋃v→∈Vi⁢(ai)□v→ and Fi′⊆⋃v→∈Vi⁢(ai′)□v→. Hence, V∗⊆⋃i=1d−1(Vi⁢(ai)∪Vi⁢(ai′)) and

∑v→∈V∗Tv→≤∑i=1d−1(∑v→∈Vi⁢(ai)Tv→+∑v→∈Vi⁢(ai′)Tv→).

Combining Corollary 6 and Fact 8, we have for every v→∈V∗ and every permutation σ of [d−1],

Tv→=O~⁢(nr⋅∏i=1d−1Φσ,□v→⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬv→),i)).

Fix i∈[d−1] and choose a permutation σ whose first element is i. Applying Lemma 11 to the tube Vi⁢(ai) (and similarly to Vi⁢(ai′)) yields

∑v→∈Vi⁢(ai)Tv→=O~⁢(nr⋅(n/r+r)d−2),∑v→∈Vi⁢(ai′)Tv→=O~⁢(nr⋅(n/r+r)d−2).

Since d is a constant, n/r⋅(n/r+r)d−2=O⁢((n/r)d−1+n⁢rd−3). Summing over all i∈[d−1] (a constant number of terms) yields the desired bound. ◀

Combining Corollary 12 with the O~⁢(rd−1) cost for the cells outside V∗ shows that the update time is O~⁢((n/r)d−1+n⁢rd−3+rd−1). Moreover, the middle term is always dominated by the other two terms: if r≤n then n⁢rd−3≤(n/r)d−1, while if r≥n then n⁢rd−3≤rd−1. Therefore, the update time is O~⁢((n/r)d−1+rd−1). Setting r=n yields O~⁢(n(d−1)/2), proving Theorem 1.

6 Adaptation to dynamic Klee’s measure

In this section, we explain how to modify the data structure from the previous sections to maintain Klee’s measure for axis-parallel boxes in the fully dynamic setting. The proofs of this section are defer to Appendix B.

6.1 Offline subroutine

We first modify the offline algorithm from Section 4. The only additional ingredient is the following analogue of Fact 3.

Fact 13.

Let ℒ be a set of slabs in ℝc and □ be a fixed box in ℝc. Then we have 1−𝖪𝗅𝖾𝖾□⁢(ℒ)/V⁢(□)=∏i=1c(1−𝖪𝗅𝖾𝖾□⁢(ℒi)/V⁢(□)), where ℒi⊆ℒ consists of the slabs bounded in dimension i and V⁢(□) denotes the volume of □.

Fact 13 implies an analogue of Lemma 4, namely a dynamic inside-□ Klee’s measure data structure for slabs with O⁢(log⁡n) update time. Using this slab data structure in place of Lemma 4, we obtain an analogue of Lemma 5 for Offline Inside-□ Box Klee’s Measure with the same running-time bound.

To formulate the analogue of Corollary 6, we define the inside-R measure function of ℬ as κRℬ:ℝ→ℝ, where

κRℬ⁢(p):=𝖪𝗅𝖾𝖾R×{p}⁢(ℬ)for all ⁢p∈ℝ.

As in the maximum-depth setting, κRℬ is a piecewise constant function whose breakpoints lie among the endpoints of the intervals in 𝐩𝐫𝐨𝐣d⁢(ℬ), and hence it has O⁢(|ℬ|) pieces. The following corollary follows by the same sweep-line reduction as in the proof of Corollary 6.

Corollary 14.

Let σ be a permutation of [d−1] and □ be a fixed box in ℝd−1. Given a set ℬ of n boxes in ℝd, one can use O⁢(n⁢log⁡n⋅∏i=1d−1Φσ,□⁢(𝐩𝐫𝐨𝐣[d−1]⁢(ℬ),i)) time to compute the inside-□ measure function κ□ℬ.

6.2 Dynamic data structure

We now modify the dynamic data structure from Section 5. We use the same partition of ℝd into rd−1 cells indexed by v→∈[r]d−1, and we maintain 𝖪𝗅𝖾𝖾□v→×ℝ⁢(ℬ) for each cell individually. We follow the notation from Section 5.

Recall that for maximum depth we maintained, for each v→, a weighted interval multiset ℐv→ that encodes the inside-□v→ depth function. For Klee’s measure, we define ℐv→ analogously, replacing the pieces of δ□v→ℬv→ by the pieces of κ□v→ℬv→. However, the relation between 𝖪𝗅𝖾𝖾□v→×ℝ⁢(ℬ) and ℐv→ is slightly more involved. We therefore separate ℐv→ into two parts: let ℐv→′⊆ℐv→ be the set of (weight-1) intervals corresponding to boxes B∈ℬ with □v→⊆𝐩𝐫𝐨𝐣[d−1]⁢(B), and let ℐv→′′⊆ℐv→ be the set of intervals corresponding to the pieces of the function κ□v→ℬv→. For each I∈ℐv→′′, we denote its weight by w⁢(I):=κ□v→ℬv→⁢(I). For a set ℐ of intervals, we write ⋃ℐ for the union of the intervals in ℐ.

Fact 15.

𝖪𝗅𝖾𝖾□v→×ℝ⁢(ℬ)=𝖪𝗅𝖾𝖾⁢(ℐv→′)⋅V⁢(□v→)+∑I∈ℐv→′′V⁢(I\⋃ℐv→′)⋅w⁢(I).

To evaluate the right-hand side of Fact 15, we store ℐv→′ and ℐv→′′ in two data structures 𝐃v→′ and 𝐃v→′′. The data structure 𝐃v→′ maintains 𝖪𝗅𝖾𝖾⁢(ℐv→′) and also supports range queries for Klee’s measure; this additional capability is needed when constructing and maintaining 𝐃v→′′. The data structure 𝐃v→′′ maintains the quantity ∑I∈ℐv→′′V⁢(I\⋃ℐv→′)⋅w⁢(I).

Before defining 𝐃v→′, we introduce an auxiliary structure 𝐀 on ℐv→′. Given a pair (L,R) of query intervals, 𝐀 checks whether there exists an interval in ℐv→′ whose left endpoint lies in L and right endpoint lies in R. Such a structure can be obtained by mapping each interval in ℐv→′ to a point in ℝ2 (left endpoint as the x-coordinate and right endpoint as the y-coordinate), reducing the query to dynamic 2D orthogonal range emptiness. Standard dynamic range-emptiness structures (e.g., dynamic 2D range trees) support both updates and queries in O~⁢(1) time, and we use 𝐀 as such a black box.

Next, we define 𝐃v→′, a dynamic range Klee’s measure data structure built on ℐv→′.

Definition 16.

A dynamic range Klee’s measure data structure stores a set ℐ of intervals and supports the following three operations:

  • ■

    Insertion: Insert a new interval into ℐ.

  • ■

    Deletion: Delete an existing interval from ℐ.

  • ■

    Query: For a query interval Q, return 𝖪𝗅𝖾𝖾Q⁢(ℐQ) where ℐQ={I∈ℐ:Q⊈I}.

Lemma 17.

There exists a dynamic range Klee’s measure data structure with O~⁢(1) amortized update time and O~⁢(1) query time.

Let 𝐃v→′ be the data structure from Lemma 17 instantiated on ℐv→′. Querying 𝐃v→′ with Q=(−∞,+∞) returns 𝖪𝗅𝖾𝖾⁢(ℐv→′).

We now define 𝐃v→′′. It is an interval tree built on ℐv→′′, whose stored values depend on both ℐv→′′ and ℐv→′. The intervals in ℐv→′′ form a partition of ℝ. The leaves of 𝐃v→′′ correspond one-to-one to the intervals in ℐv→′′, in left-to-right order. For a node t of 𝐃v→′′, let ℐv→′′⁢(t)⊆ℐv→′′ denote the set of leaf intervals in the subtree rooted at t, and define

ℐv→′⁢(t):={I∈ℐv→′:⋃ℐv→′′⁢(t)⊈I}.

At node t we store the value

η⁢(t):=∑I∈ℐv→′′⁢(t)V⁢(I\⋃ℐv→′⁢(t))⋅w⁢(I).

If t has children s1 and s2, then ℐv→′⁢(t)⊆ℐv→′⁢(s1)∩ℐv→′⁢(s2), and η⁢(t) can be computed from η⁢(s1) and η⁢(s2) by testing, for each child s∈{s1,s2}, whether ℐv→′⁢(s)=ℐv→′⁢(t). We set η′⁢(s)=η⁢(s) if ℐv→′⁢(s)=ℐv→′⁢(t) and η′⁢(s)=0 otherwise, and then η⁢(t)=η′⁢(s1)+η′⁢(s2). Using 𝐀, this equality test can be performed in O~⁢(1) time, and hence η⁢(t) can be computed in O~⁢(1) time given η⁢(s1) and η⁢(s2).

If t is a leaf corresponding to an interval I∈ℐv→′′, then

η⁢(t)=(V⁢(I)−𝖪𝗅𝖾𝖾I⁢(ℐv→′⁢(t)))⋅w⁢(I).

We obtain 𝖪𝗅𝖾𝖾I⁢(ℐv→′⁢(t)) by querying 𝐃v→′ with Q=I in O~⁢(1) time, and then compute η⁢(t) in O~⁢(1) time. It follows that 𝐃v→′′ can be built in O~⁢(|ℐv→′′|) time by a bottom-up construction.

After an insertion or deletion in ℐv→′, we can update 𝐃v→′′ in O~⁢(1) time. Consider an interval I inserted into ℐv→′ or deleted from ℐv→′. Let t1 and t2 be the two leaves of 𝐃v→′′ whose corresponding intervals in ℐv→′′ contain the endpoints of I. Let πi be the path from the root to ti, for i∈{1,2}. Only nodes on π1∪π2 may change, and we can update them bottom-up, spending O~⁢(1) time per visited node. Since |π1|,|π2|=O~⁢(1), the total update time is O~⁢(1). We do not separately support insertions/deletions to ℐv→′′: in our setting, whenever ℐv→′′ changes, it changes globally, and we rebuild 𝐃v→′′ from scratch on the new ℐv→′′.

At this point, 𝐃v→′ provides 𝖪𝗅𝖾𝖾⁢(ℐv→′), and the root of 𝐃v→′′ stores ∑I∈ℐv→′′V⁢(I\⋃ℐv→′)⋅w⁢(I). Applying Fact 15 yields 𝖪𝗅𝖾𝖾□v→×ℝ⁢(ℬ).

Update time

Finally, we consider the update time for a fixed cell □v→×ℝ when a box B is inserted into ℬ or deleted from ℬ. If □v→⊆𝐩𝐫𝐨𝐣[d−1]⁢(B), then we insert into ℐv→′ (or delete from ℐv→′) the interval 𝐩𝐫𝐨𝐣d⁢(B). In this case we update 𝐀 and 𝐃v→′, and then update 𝐃v→′′ as described above; the total cost is O~⁢(1).

Otherwise, we recompute the inside-□v→ measure function κ□v→ℬv→ and rebuild 𝐃v→′′ on the resulting set ℐv→′′ of pieces. By Corollary 14, the cost of recomputing κ□v→ℬv→ matches (up to logarithmic factors) the cost of recomputing δ□v→ℬv→ in the maximum-depth structure. Moreover, rebuilding 𝐃v→′′ costs O~⁢(|ℐv→′′|)=O~⁢(|ℬv→|), since the number of pieces of κ□v→ℬv→ is O⁢(|ℬv→|). Therefore, the per-cell update time is the same as in the maximum-depth setting up to logarithmic factors. Applying the same global analysis as in Section 5 yields an overall amortized update time O~⁢(n(d−1)/2), proving Theorem 2.

7 Conclusion and open questions

In this paper, we develop fully dynamic data structures for maintaining the maximum depth and Klee’s measure of a set of axis-parallel boxes in any constant dimension d, achieving a near-optimal amortized update time of O~⁢(n(d−1)/2). While this update time is close to the conjectured lower bound, several directions remain open for future investigation.

A first and perhaps most natural question is whether one can eliminate the logarithmic factors in the update time, mirroring the historical progression of static Klee’s measure algorithms [29, 12, 13]. A second direction is to improve the preprocessing time and the space complexity. It is plausible that the preprocessing can be reduced to O⁢(nd/2) time, whereas our current preprocessing and space usage is comparatively brute-force and requires O~⁢(n(d+1)/2) time and space.

Our results address the exact problems in the fully dynamic setting, but it is also natural to study relaxations. For instance, one may ask whether maintaining a (1−ε)-approximation to the maximum depth or to Klee’s measure admits asymptotically faster updates. Another variant is the semi-dynamic setting, where updates are restricted to insertions only or deletions only. It remains open whether these relaxations allow substantially smaller update times.

Since this work focuses on boxes, an obvious next step is to design dynamic maximum-depth data structures for other object families, such as balls, simplices, or more general convex bodies. These extensions appear considerably more challenging, as the maximum-depth problem is already known to be 3SUM-hard even for disks [4].

Finally, from a technical perspective, it is also interesting to explore whether our charging analysis can be applied to other partitioning-based problems involving boxes.

References

  • [1] Peyman Afshani and Timothy M. Chan. On approximate range counting and depth. Discrete Comput. Geom., 42(1):3–21, 2009. doi:10.1007/S00454-009-9177-Z.
  • [2] Pankaj K. Agarwal, Hsien-Chih Chang, Subhash Suri, Allen Xiao, and Jie Xue. Dynamic geometric set cover and hitting set. ACM Trans. Algorithms, 18(4):40:1–40:37, 2022. doi:10.1145/3551639.
  • [3] Helmut Alt and Ludmila Scharf. Computing the depth of an arrangement of axis-aligned rectangles in parallel. In Abstr. 26th Eur. Workshop Comput. Geom. (EuroCG), pages 33–36, 2010.
  • [4] Boris Aronov and Sariel Har-Peled. On approximating the depth and related problems. SIAM J. Comput., 38(3):899–921, 2008. doi:10.1137/060669474.
  • [5] Jérémy Barbay, Timothy M. Chan, Gonzalo Navarro, and Pablo Pérez-Lantero. Maximum-weight planar boxes in time O⁢(n2) (and better). Inf. Process. Lett., 114(8):437–445, 2014.
  • [6] Jon Louis Bentley. Algorithms for klee’s rectangle problem. Unpublished manuscript, 1977.
  • [7] Sujoy Bhore and Timothy M. Chan. Dynamic independent set of disks (and hypercubes) made easier. In Proc. 8th Sympos. Simplicity in Algorithms (SOSA), pages 485–495, 2025. doi:10.1137/1.9781611978315.36.
  • [8] Sujoy Bhore and Timothy M. Chan. Fast static and dynamic approximation algorithms for geometric optimization problems: Piercing, independent set, vertex cover, and matching. In Proc. 36th ACM-SIAM Sympos. Discrete Algs. (SODA), pages 2357–2386, 2025. doi:10.1137/1.9781611978322.79.
  • [9] Sujoy Bhore, Martin Nöllenburg, Csaba D. Tóth, and Jules Wulms. Fully dynamic maximum independent sets of disks in polylogarithmic update time. In Proc. 40th Int. Annu. Sympos. Comput. Geom. (SoCG), pages 19:1–19:16, 2024. doi:10.4230/LIPIcs.SOCG.2024.19.
  • [10] Timothy M. Chan. Dynamic planar convex hull operations in near-logarithmic amortized time. J. ACM, 48(1):1–12, 2001. doi:10.1145/363647.363652.
  • [11] Timothy M. Chan. Dynamic coresets. Discrete Comput. Geom., 42(3):469–488, 2009. doi:10.1007/S00454-009-9165-3.
  • [12] Timothy M. Chan. A (slightly) faster algorithm for Klee’s measure problem. Comput. Geom., 43(3):243–250, 2010. doi:10.1016/J.COMGEO.2009.01.007.
  • [13] Timothy M. Chan. Klee’s measure problem made easy. In Proc. 54th Annu. IEEE Sympos. Found. Comput. Sci. (FOCS), pages 410–419, 2013. doi:10.1109/FOCS.2013.51.
  • [14] Timothy M. Chan. Dynamic geometric data structures via shallow cuttings. Discrete Comput. Geom., 64(4):1235–1252, 2020. doi:10.1007/S00454-020-00229-5.
  • [15] Timothy M. Chan and Qizheng He. More dynamic data structures for geometric set cover with sublinear update time. J. Comput. Geom., 13(2):90–114, 2021. doi:10.20382/JOCG.V13I2A6.
  • [16] Timothy M. Chan, Qizheng He, Subhash Suri, and Jie Xue. Dynamic geometric set cover, revisited. In Proc. 33rd ACM-SIAM Sympos. Discrete Algorithms (SODA), pages 3496–3528, 2022. doi:10.1137/1.9781611977073.139.
  • [17] Timothy M. Chan and Konstantinos Tsakalidis. Dynamic orthogonal range searching on the RAM, revisited. J. Comput. Geom., 9(2):45–66, 2018. doi:10.20382/JOCG.V9I2A5.
  • [18] Bernard Marie Chazelle and D. T. Lee. On a circle placement problem. Computing, 36(1-2):1–16, 1986. doi:10.1007/BF02238188.
  • [19] Ludwig Danzer, Branko Grünbaum, and Victor Klee. Helly’s theorem and its relatives. In Convexity, Proc. Sympos. Pure Math., Vol. 7, Amer. Math. Soc., volume 7, page 101, 1963.
  • [20] David Dobkin and Subhash Suri. Maintenance of geometric extrema. J. ACM, 38(2):275–298, 1991. doi:10.1145/103516.103518.
  • [21] D. Eppstein. Dynamic Euclidean minimum spanning trees and extrema of binary functions. Discrete Comput. Geom., 13(1):111–122, 1995. doi:10.1007/BF02574030.
  • [22] Monika Henzinger, Stefan Neumann, and Andreas Wiese. Dynamic approximate maximum independent set of intervals, hypercubes and hyperrectangles. In Proc. 36th Int. Sympos. Comput. Geom. (SoCG), pages 51:1–51:14, 2020. doi:10.4230/LIPIcs.SOCG.2020.51.
  • [23] John Hershberger and Subhash Suri. Off-line maintenance of planar configurations. J. Algorithms, 21(3):453–475, 1996. doi:10.1006/JAGM.1996.0054.
  • [24] Hiroshi Imai and Takao Asano. Finding the connected components and a maximum clique of an intersection graph of rectangles in the plane. J. Algorithms, 4(4):310–323, 1983. doi:10.1016/0196-6774(83)90012-3.
  • [25] Victor Klee. Can the measure of ⋃i=1n[ai,bi] be computed in less than o⁢(n⁢log⁡n) steps? Amer. Math. Monthly, 84(4):284–285, 1977.
  • [26] Jiri Matousek. Lectures on discrete geometry, volume 212. Springer Science & Business Media, 2013.
  • [27] Christian Worm Mortensen. Fully dynamic orthogonal range reporting on ram. SIAM J. Comput., 35(6):1494–1525, 2006. doi:10.1137/S0097539703436722.
  • [28] Mark H. Overmars and Jan van Leeuwen. Maintenance of configurations in the plane. J. Comput. Syst. Sci., 23(2):166–204, 1981. doi:10.1016/0022-0000(81)90012-X.
  • [29] Mark H. Overmars and Chee-Keng Yap. New upper bounds in Klee’s measure problem. SIAM J. Comput., 20(6):1034–1045, 1991. doi:10.1137/0220065.
  • [30] Subhash Suri, Jie Xue, Xiongxin Yang, and Jiumu Zhu. Dynamic maximum depth of geometric objects. In Proc. 41st Int. Annu. Sympos. Comput. Geom. (SoCG), pages 77:1–77:13, 2025. doi:10.4230/LIPIcs.SOCG.2025.77.
  • [31] Jan van Leeuwen and Derick Wood. The measure problem for rectangular ranges in d-space. J. Algorithms, 2(3):282–300, 1981. doi:10.1016/0196-6774(81)90027-4.

Appendix A Low-level implementation details

In this section, we provide the implementation details omitted in Section 5, namely periodic reconstruction and the splitting procedure.

A.1 Reconstruction

Our data structure uses the standard technique of periodic reconstruction, as in [30]. After the i-th reconstruction, let ni:=|ℬ| denote the number of boxes at that time. We then perform ni/2 update operations before initiating the (i+1)-st reconstruction. During this i-th period, i.e., the interval between the i-th and (i+1)-st reconstructions, we therefore have |ℬ|=Θ⁢(ni).

Since our data structure supports updates in O⁢(n(d−1)/2⁢log⁡n) time on a set of size n, we can rebuild it from scratch in O⁢(n(d+1)/2⁢log⁡n) time by inserting the n boxes one by one. Thus, the (i+1)-st reconstruction takes O⁢(ni(d+1)/2⁢log⁡ni) time. Amortizing this cost over the ni/2 operations in the i-th period yields an amortized reconstruction cost of O⁢(ni(d−1)/2⁢log⁡ni) per operation, which keeps the amortized update time at O⁢(n(d−1)/2⁢log⁡n).

A.2 Splitting

We now describe how to maintain the invariant assumed in Section 5: for each i∈[d−1], the number of corners of boxes in ℬ lying between any two consecutive hyperplanes in ℋi is always O⁢(n/r).

Fix i∈[d−1] and consider a reconstruction period in which the set size satisfies |ℬ|=Θ⁢(n) (where n denotes the size at the beginning of the period). The hyperplanes in ℋi partition ℝd into slabs along the xi-axis. Whenever the number of corners of boxes in ℬ in the slab defined by two consecutive hyperplanes Hai−1,Hai∈ℋi reaches 2d+1⁢n/r, we insert a new hyperplane H′ perpendicular to the xi-axis between Hai−1 and Hai so that the numbers of corners in the two new slabs (between Hai−1 and H′ and between H′ and Hai) are both exactly 2d⁢n/r. Consequently, every cell □v→×ℝ whose i-th coordinate equals ai is split into two cells □′×ℝ and □′′×ℝ.

By construction, immediately after the split, each of the two new slabs contains at most 2d⁢n/r corners, and a slab is split only once it accumulates 2d+1⁢n/r corners. Thus, at all times, the number of corners between any two consecutive hyperplanes in ℋi is at most 2d+1⁢n/r=O⁢(n/r).

On the other hand, to make the proof in Section 5 go through, we also need to ensure that the total number of cells remains O⁢(rd−1) despite splittings. This is guaranteed by the following fact, which is a direct generalization of Fact 4 in [30].

Fact 18.

Over the first t update operations within a reconstruction period (with parameter n fixed at the beginning of the period), the number of splittings along any fixed axis is at most 2⁢t⁢r/n.

Proof.

Since deletions do not trigger splitting, it suffices to account for insertions among the t operations. Fix an axis i∈[d−1]. For each inserted box B, we charge it to the (at most) two slabs along the xi-axis, defined by consecutive hyperplanes in ℋi, that contain corners of B at the time of insertion.

Each such charge corresponds to inserting at most 2d new corners into the charged slab. Therefore, a slab S must receive at least n/r charges before its number of corners grows from at most 2d⁢n/r to 2d+1⁢n/r, at which point S is split. Equivalently, every split of a slab S is preceded by at least n/r charges to S. Since each insertion contributes at most two charges along the xi-axis, the total number of charges along this axis over the first t operations is at most 2⁢t. It follows that the number of splits along the xi-axis is at most 2⁢tn/r=2⁢t⁢rn, as claimed. ◀

Corollary 19.

Despite splittings, the number of cells remains O⁢(rd−1).

Proof.

Consider an arbitrary reconstruction period. By construction, the period contains at most n/2 update operations. By Fact 18, the number of slab splittings along each axis is at most

2⋅(n/2)⋅rn=r.

Since we start the period with r slabs along each axis, after at most r additional splits the number of slabs along each axis is at most r+r. Therefore, the total number of cells is at most (r+r)d−1=O⁢(rd−1). ◀

Appendix B Missing proofs

B.1 Proof of Fact 8

Proof.

Item 1 follows directly from the construction (and maintenance) of ℋi: for each i∈[d−1] and each a∈[r], the cells {□v→×ℝ:v→∈Vi⁢(a)} form exactly the slab between two consecutive hyperplanes in ℋi, and by invariant this slab contains O⁢(n/r) corners of boxes in ℬ. Thus γi⁢(a)=O⁢(n/r).

Item 2 is immediate from the definitions. Fix i,j∈[d−1] and b∈[r]. The sets Vi,j⁢(a,b) partition Vj⁢(b) as a ranges over [r], and therefore

∑a=1rγi,j⁢(a,b)=∑a=1r∑v→∈Vi,j⁢(a,b)|𝖼𝗈𝗋⁢(ℬ)∩(□v→×ℝ)|=∑v→∈Vj⁢(b)|𝖼𝗈𝗋⁢(ℬ)∩(□v→×ℝ)|=γj⁢(b).

For Item 3, fix v→=(a1,…,ad−1)∈[r]d−1 and consider any box B∈ℬv→. By definition of ℬv→, we have 𝐩𝐫𝐨𝐣[d−1]⁢(B)∩□v→≠∅ and □v→⊈𝐩𝐫𝐨𝐣[d−1]⁢(B). Hence there exists a dimension i∈[d−1] such that 𝐩𝐫𝐨𝐣i⁢(□v→)⊈𝐩𝐫𝐨𝐣i⁢(B). Since 𝐩𝐫𝐨𝐣i⁢(□v→) intersects 𝐩𝐫𝐨𝐣i⁢(B), at least one endpoint of 𝐩𝐫𝐨𝐣i⁢(B) lies in the interior of 𝐩𝐫𝐨𝐣i⁢(□v→). Equivalently, there is a facet F of 𝐩𝐫𝐨𝐣[d−1]⁢(B) perpendicular to the xi-axis that intersects □v→.

Let F′ be the corresponding facet of B in ℝd, and let z∈𝖼𝗈𝗋⁢(B) be any corner incident to F′. Then z lies in the slab with i-th coordinate equal to ai, and therefore z∈□u→×ℝ for some u→∈Vi⁢(ai). We charge the box B to this corner z. Doing this for every B∈ℬv→ yields

|ℬv→|≤∑i=1d−1∑u→∈Vi⁢(ai)|𝖼𝗈𝗋⁢(ℬ)∩(□u→×ℝ)|=∑i=1d−1γi⁢(ai),

which is exactly Item 3. ◀

B.2 Proof of Fact 13

Fix i∈[c]. Every slab L∈ℒi is unbounded in all coordinates except the i-th one. Let Ui:=⋃L∈ℒi𝐩𝐫𝐨𝐣i⁢(L∩□)⊆𝐩𝐫𝐨𝐣i⁢(□). Then ⋃L∈ℒi(L∩□)=∏j=1i−1𝐩𝐫𝐨𝐣j⁢(□)×Ui×∏j=i+1c𝐩𝐫𝐨𝐣j⁢(□), and therefore

𝖪𝗅𝖾𝖾□⁢(ℒi)=V⁢(⋃L∈ℒi(L∩□))=|Ui|⋅∏j≠i|𝐩𝐫𝐨𝐣j⁢(□)|.

Dividing by V⁢(□)=∏j=1c|𝐩𝐫𝐨𝐣j⁢(□)| gives

1−𝖪𝗅𝖾𝖾□⁢(ℒi)V⁢(□)=1−|Ui||𝐩𝐫𝐨𝐣i⁢(□)|=|𝐩𝐫𝐨𝐣i⁢(□)|−|Ui||𝐩𝐫𝐨𝐣i⁢(□)|.

Now consider the full slab set ℒ=⋃i=1cℒi. Inside □, the complement of the union is

□∖⋃L∈ℒ(L∩□) =□∩⋂i=1c(□∖⋃L∈ℒi(L∩□))
=⋂i=1c(∏j≠i𝐩𝐫𝐨𝐣j⁢(□)×(𝐩𝐫𝐨𝐣i⁢(□)∖Ui))=∏i=1c(𝐩𝐫𝐨𝐣i⁢(□)∖Ui).

Taking volumes yields V⁢(□)−𝖪𝗅𝖾𝖾□⁢(ℒ)=∏i=1c(|𝐩𝐫𝐨𝐣i⁢(□)|−|Ui|). Dividing by V⁢(□) and substituting the expression for each ℒi gives

1−𝖪𝗅𝖾𝖾□⁢(ℒ)V⁢(□)=∏i=1c|𝐩𝐫𝐨𝐣i⁢(□)|−|Ui||𝐩𝐫𝐨𝐣i⁢(□)|=∏i=1c(1−𝖪𝗅𝖾𝖾□⁢(ℒi)V⁢(□)).

B.3 Proof of Fact 15

Proof.

Let U:=⋃ℐv→′⊆ℝ be the union of the type-1 intervals. For each p∈ℝ, define the cross-section value

m⁢(p):=𝖪𝗅𝖾𝖾□v→×{p}⁢(ℬ)=V⁢((⋃B∈ℬB)∩(□v→×{p})).

By Fubini’s theorem (or equivalently by additivity of volume along the xd-axis),

𝖪𝗅𝖾𝖾□v→×ℝ⁢(ℬ)=∫ℝm⁢(p)⁢𝑑p.

If p∈U, then there exists a box B∈ℬ such that □v→⊆𝐩𝐫𝐨𝐣[d−1]⁢(B) and p∈𝐩𝐫𝐨𝐣d⁢(B), which implies □v→×{p}⊆B and hence m⁢(p)=V⁢(□v→). If p∉U, then no such box exists, and the only boxes contributing to the cross section inside □v→×{p} are those in ℬv→. By definition of the inside-□v→ measure function, we then have m⁢(p)=κ□v→ℬv→⁢(p). Since ℐv→′′ is precisely the set of pieces of κ□v→ℬv→, for each I∈ℐv→′′ the function equals the constant w⁢(I) on I.

Therefore,

𝖪𝗅𝖾𝖾□v→×ℝ⁢(ℬ) =∫p∈UV⁢(□v→)⁢𝑑p+∫p∉Uκ□v→ℬv→⁢(p)⁢𝑑p
=V⁢(□v→)⋅|U|+∑I∈ℐv→′′w⁢(I)⋅|I∖U|
=𝖪𝗅𝖾𝖾⁢(ℐv→′)⋅V⁢(□v→)+∑I∈ℐv→′′V⁢(I\⋃ℐv→′)⋅w⁢(I).

◀

B.4 Proof of Lemma 17

We first observe the following simple fact.

Fact 20.

For any disjoint intervals X and Y and any interval set ℐ, 𝖪𝗅𝖾𝖾X∪Y⁢(ℐ)=𝖪𝗅𝖾𝖾X⁢(ℐ)+𝖪𝗅𝖾𝖾Y⁢(ℐ).

Let {e1<⋯<eN} be the sorted distinct endpoints of all intervals in ℐ. Define Ai=(ei,ei+1) for 1≤i≤N−1, and A0=(−∞,e1), AN=(eN,∞). Let 𝒜={A0,…,AN} be the set of these disjoint intervals. We consider a standard BST 𝒯 on 𝒜 storing the atomic intervals Ai∈𝒜 at its leaf nodes. For any node v∈𝒯, let Av denote the interval spanned by its leaf descendants (atomic interval Ai if v is a leaf). Define

κ⁢(v)={|Ai|⋅𝟏[∃I∈ℐ:ℓ(I)=ei or r(I)=ei+1] where I=[ℓ(I),r(I)],if v is a leaf,∑v′∈v.children(κ⁢(v′)⋅𝟏⁢[ℐAv=ℐAv′]+|Av′|⋅𝟏⁢[ℐAv≠ℐAv′]),if v is internal.
Fact 21.

κ⁢(v)=𝖪𝗅𝖾𝖾Av⁢(ℐAv) for all v∈𝒯.

Proof.

The claim holds trivially when v is a leaf node. Since Ai is atomic, ℐAi is nonempty when some I∈ℐ includes Ai and defines one of its endpoints, thus 𝖪𝗅𝖾𝖾Ai⁢(ℐAi)=|Ai|. Otherwise, ℐAi=∅ and the measure is 0. If v is an internal node, then by Fact 20, 𝖪𝗅𝖾𝖾Av⁢(ℐAv)=∑v′∈v.children𝖪𝗅𝖾𝖾Av′⁢(ℐAv). Thus it suffices to show that for each child v′ either 𝖪𝗅𝖾𝖾Av′⁢(ℐAv)=κ⁢(v′)⁢ or ⁢|Av′|. If ℐAv=ℐAv′ then 𝖪𝗅𝖾𝖾Av′⁢(ℐAv)=𝖪𝗅𝖾𝖾Av′⁢(ℐAv′)=κ⁢(v′) trivially by induction. Otherwise ℐAv≠ℐAv′, and since Av′⊆Av we cannot have an interval that contains Av but fails to contain Av′, so the difference lies in the existence of some I′∈ℐAv∖ℐAv′. Thus I′ is an interval that fully contains Av′ but does not contain Av, consequently every point of Av′ lies in some interval of ℐAv, and therefore 𝖪𝗅𝖾𝖾Av′⁢(ℐAv)=|Av′|. ◀

To compute 𝖪𝗅𝖾𝖾Q⁢(ℐQ), let 𝒱 denote the O⁢(log⁡N) canonical nodes whose intervals {Av:v∈𝒱} form a disjoint partition of Q. By Fact 20, 𝖪𝗅𝖾𝖾Q⁢(ℐQ)=∑v∈𝒱𝖪𝗅𝖾𝖾Av∩Q⁢(ℐQ). For each v∈𝒱. If Av⊆Q, then 𝖪𝗅𝖾𝖾Av∩Q⁢(ℐQ)=𝖪𝗅𝖾𝖾Av⁢(ℐQ)=𝖪𝗅𝖾𝖾Av⁢(ℐAv)⋅𝟏⁢[ℐAv=ℐQ]+|Av|⋅𝟏⁢[ℐAv≠ℐQ]. Otherwise if Av⊈Q, then v is necessarily a leaf corresponding to some atomic interval Ai, and 𝖪𝗅𝖾𝖾Av∩Q⁢(ℐQ)=𝖪𝗅𝖾𝖾Ai∩Q⁢(ℐQ)=κ⁢(Ai)⋅|Ai∩Q|/|Ai|. Since 𝟏⁢[ℐAv=ℐQ] can be evaluated in O~⁢(1) time using the auxiliary structure 𝐀, and |𝒱|=O⁢(log⁡N), the value of 𝖪𝗅𝖾𝖾Q⁢(ℐQ) can be computed in O~⁢(1) time via queries to 𝒯.

Furthermore, insertions or deletions of an interval I′ in ℐ can be reflected in 𝒯 in O~⁢(1) time. Observe that κ⁢(v) remains unchanged for any node v spanned by I′, since by definition I′∉ℐAv={I∈ℐ:Av⊈I} if Av⊆I′. Hence, the update only affects leaves incident to endpoints of I′ and the leaves’ ancestors. Accounting for rotations, splits, and merges in 𝒯, at most O⁢(log⁡N) nodes are changed in 𝒯. Let P be the union of root-to-leaf paths from affected nodes. For each v∈P, recomputing κ⁢(v) using 𝐀 takes O~⁢(1) time and restores the invariant κ⁢(v)=𝖪𝗅𝖾𝖾Av⁢(ℐAv). Therefore, the total update time is O~⁢(1).