A range query retrieves points satisfying a spatial constraint, such as lying within a radius of a center or within independent coordinate bounds. Multidimensional trees prune branches whose regions cannot intersect the query region. section 9.3.6
Common forms differ by the geometry of the requested region:
- A spherical query returns points within a specified Euclidean distance of a center; recursive search checks the nearer branch and visits the other when the splitting boundary intersects the sphere. section 9.3.6
- A rectangular query tests every coordinate against a minimum and maximum, then recursively explores only branches intersecting the hyper-rectangle. section 9.3.6
- A region with constraints that mix features is harder than an axis-aligned rectangle and may require a more complex optimization method. section 9.3.6
Performance depends on the region. A small region may follow one path in O(h), or O(log n) in a balanced tree; a region containing all points traverses the tree in O(n), which is the worst-case bound. section 9.3.6
DBSCAN neighborhoods
DBSCAN uses a range query to find every point within radius eps of each point. An indexing structure can reduce the overall work from O(n²) toward O(n log n) when queries typically cost O(log n), although individual queries still have an O(n) worst case. section 12.3.3
Figure 9.26 Region search on a k-d tree returns all the points in a k-d tree within a given hyper-rectangle. This means looking for points that, for each coordinate, satisfy two inequalities: each coordinate must be within a range. For instance, in this 2-D example, the points’ x coordinates need to be between -2 and 3.5, and y coordinates between -4 and 2.
Visualizes a two-dimensional hyper-rectangle by showing independent bounds for each coordinate and the points returned by the query. section 9.3.6


