How fast can orthogonal range search be, and why?
The naive baseline scans all n points in O(n) per query — acceptable once, catastrophic at scale.
Binary search in 1-D sorts points by x and finds both endpoints in O(logn), then outputs the k points in between in O(logn+k). A simple sorted array is optimal in one dimension.
Range trees in 2-D nest a second sorted structure inside each node:
- Build a balanced BST on the x-coordinates (primary tree).
- At each node v, store a secondary sorted array of the y-coordinates of all points in v's subtree (fractional cascade / associated structure).
- To query [x1,x2]×[y1,y2]: find the O(logn) canonical nodes whose x-subtrees cover [x1,x2], then binary-search [y1,y2] inside each secondary structure.
Without fractional cascading this takes O(log2n+k): O(logn) canonical nodes, each requiring an O(logn) binary search.
With fractional cascading (Chazelle & Guibas, 1986) the secondary searches take O(1) after an O(logn) initial lookup, dropping the total to O(logn+k).
Space is O(nlogn) in 2-D and O(nlogd−1n) in d dimensions — each of the O(n) points appears in O(logn) secondary structures.
Lower bound: any pointer-machine data structure for orthogonal range reporting requires Ω(logn/loglogn+k) query time (Chazelle, 1990). So range trees with fractional cascading are essentially optimal.
This is not an open problem — it is a closed chapter of computational geometry. Compare this to sorting lower bounds, where the same style of adversary argument shows Ω(nlogn) comparisons are unavoidable.
Comments
Loading comments...