Papers
Topics
Authors
Recent
Search
2000 character limit reached

Priority Search Trees for Orthogonal Queries

Updated 15 January 2026
  • Priority Search Trees are binary data structures that combine a y-coordinate heap-order with an in-order x arrangement to efficiently support 3D orthogonal range queries.
  • The construction algorithm recursively partitions points using medians and maximum y selections, achieving O(n log n) build time with minimal extra space.
  • Applications include the fast enumeration of maximal empty axis-parallel rectangles, making them vital for computational geometry and spatial analytics such as VLSI design.

A priority search tree (@@@@1@@@@) is a binary data structure that organizes a set of planar points P={p1,,pn}P = \{p_1, \dotsc, p_n\}, each p=(x(p),y(p))p = (x(p), y(p)), to efficiently support three-dimensional orthogonal range queries of the form: “report (or optimize) over all points pp such that x[a,b]x \in [a, b] and ycy \geq c.” PSTs are characterized by simultaneously maintaining a heap-order property with respect to the yy-coordinate and an in-order property with respect to the xx-coordinate. PSTs are foundational in computational geometry and pivotal for applications such as the efficient computation of maximal empty rectangles in two dimensions (De et al., 2011).

1. Definition and Invariants

A PST is recursively defined as follows. Given a non-empty point set PP:

  • Let p=arg maxpPy(p)p^* = \operatorname*{arg\,max}_{p \in P} y(p). Make pp^* the root of the tree.
  • Remove pp^* from PP to form P=P{p}P' = P \setminus \{p^*\}.
  • Compute the median xmedx_{\mathrm{med}} of the xx-coordinates in PP'. Partition PP' into P={pP:x(p)xmed}P_\ell = \{p \in P' : x(p) \leq x_{\mathrm{med}}\} and Pr={pP:x(p)>xmed}P_r = \{p \in P' : x(p) > x_{\mathrm{med}}\}.
  • Recursively build the left and right subtrees on PP_\ell and PrP_r.

The following invariants uniquely characterize a PST (De et al., 2011):

  • Heap-order in yy: For every node vv and each child ww of vv, y(v)y(w)y(v) \geq y(w).
  • In-order in xx: An in-order traversal yields the points in non-decreasing order of xx.

Each node maintains only the coordinates of its point; child-pointers or equivalent indices determine the structure.

2. Construction Algorithms and Complexity Analysis

The classical recursive build process involves, at each node, finding the max-yy element, computing the median xx-coordinate, and partitioning accordingly. Each of these requires O(n)O(n) time at each level, yielding the recurrence

T(n)=T(n)+T(nr)+Θ(n)T(n) = T(n_\ell) + T(n_r) + \Theta(n)

with nnrn/2n_\ell \approx n_r \approx n/2. Via the Master Theorem, this gives T(n)=Θ(nlogn)T(n) = \Theta(n \log n) for total construction time.

Space consumption is O(n)O(n) words for the nodes and pointers.

An in-place BFS-level construction is also possible. This layout stores the tree in the input array P[1..n]P[1..n] in heap-like BFS order and uses a $2$-bit array TAG[1..k]\mathrm{TAG}[1..k] (k=log2(n+1))(k = \lceil \log_2(n+1)\rceil) to encode child-nulling at each level. The process, BuildInPlacePST, operates as follows:

  • For each level \ell from highest to lowest:
    • Nodes of level \ell occupy P[L+1.. M]P[L_{\ell}+1..\ M_\ell] with L=211, M=min(n,21)L_\ell = 2^{\ell-1}-1,\ M_\ell = \min(n, 2^{\ell}-1).
    • In this subarray, the root is extracted as the max-yy element, the remaining entries are in-place median-partitioned by xx, and children/grouping is determined with assistance from TAG\mathrm{TAG}.
  • Only O(logn)O(\log n) bits are used for the TAG\mathrm{TAG} array and indexing, and the entire structure is stored in-place within P[1..n]P[1..n].

Total construction time remains O(nlogn)O(n \log n); extra workspace is confined to O(logn)O(\log n) bits (De et al., 2011).

3. Array Layout and Indexing Formulas

After in-place construction, the layout has these properties:

  • BFS Shape: Level \ell nodes occupy P[L+1..M]P[L_\ell+1..M_\ell].
  • Heap-order in yy and In-order in xx: As in the pointer-based PST, maintained via construction.
  • Child indexing: For a node vv at index ii in level \ell, the left and right children are located as:

left child:2it=+1kTAG[t]\text{left child}: 2i - \sum_{t=\ell+1}^k \mathrm{TAG}[t]

right child:2i+1t=+1kTAG[t]\text{right child}: 2i + 1 - \sum_{t=\ell+1}^k \mathrm{TAG}[t]

This implicit formalism avoids explicit pointers and additional memory overhead.

4. Query Algorithms and Time Complexity

PSTs support classical three-dimensional orthogonal queries—e.g., find the minimum xx among {pax(p)b,y(p)c}\{p \mid a \leq x(p) \leq b,\, y(p) \geq c\}—in O(log2n)O(\log^2 n) time using only O(1)O(1) additional workspace. The algorithm proceeds as:

  1. Descend from the root to the discriminant node π\pi where [a,b][a, b] “splits.”
  2. At each node, determine traversal direction by comparing xx-predecessor and xx-successor found by subtree walks (each O(logn)O(\log n)).
  3. At π\pi, check y(π)cy(\pi) \geq c; if so, recurse in the left/right subtrees, pruning any where root yy drops below cc or xx-range is invalid.
  4. The recursion for a subtree of height hh satisfies Q(h)=2Q(h1)+O(logn)Q(h) = 2Q(h-1) + O(\log n), yielding Q(h)=O(hlogn)=O(log2n)Q(h) = O(h\log n) = O(\log^2 n).

Similar analysis holds for MaxXInRectangle and MaxYInXRange. Enumerative queries add an O(output)O(\text{output}) term (De et al., 2011).

Table: Time/Space Complexity of Priority Search Trees

Operation Complexity Extra Workspace
Build O(nlogn)O(n\log n) O(logn)O(\log n) bits
Query O(log2n)O(\log^2 n) O(1)O(1)
Application (MERs) O(m+nlog2n)O(m+n\log^2 n) O(logn)O(\log n) bits

5. Applications: Largest Empty Axis-Parallel Rectangle

A principal application of PSTs is in enumerating all maximal empty rectangles (MERs) within a bounding box RR given nn planar points. This is fundamental in VLSI design and spatial analysis.

The solution proceeds as:

  • Build the In-Place PST.
  • Top–down and Bottom–up Sweeps: For each pass (fixing the top/bottom on current PST maxima), two double-ended queues of size O(logn)O(\log n) maintain side candidates.
  • At each step, the action is:
    • Pop the highest from QQ_\ell or QrQ_r.
    • Report the found MER.
    • Use PST queries (e.g., MinXInRectangle on lower yy) to discover next side point.
  • After each pass, re-heapify in O(logn)O(\log n) deletes the root.
  • The total per pass is O(μ+logn)O(\mu+\log n), where μ\mu is the number of MERs found in that pass.
  • Total complexity sums to O(m+nlog2n)O(m + n\log^2 n), where mm is the number of MERs, and workspace remains O(logn)O(\log n) bits (De et al., 2011).

This establishes the PST as a space-efficient core structure for optimal enumeration of maximal empty axis-parallel rectangles.

6. Summary and Significance

Priority search trees implement an efficient mechanism for three-dimensional orthogonal range searching in planar point sets. Key contributions include:

  • A recursive/data-driven structure balancing yy-heap and xx-order for optimal query resolution.
  • In-place BFS-level construction in O(nlogn)O(n\log n) time and O(logn)O(\log n) extra bits, maintaining all invariants and enabling pointerless layouts.
  • O(log2n)O(\log^2 n) query time with O(1)O(1) workspace.
  • Immediate applications in computational geometry, notably the O(m+nlog2n)O(m+n\log^2 n) complexity for maximal empty axis-parallel rectangle enumeration, with in-place spatial efficiency.

A plausible implication is that PSTs, due to their low workspace requirements and optimal query times, are well suited for embedded, memory-constrained, and high-performance spatial analytics workflows. These results are foundational for both theory and practice in computational geometry (De et al., 2011).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Priority Search Trees.