Efficient colored orthogonal range counting

Haim Kaplan, Natan Rubin, Micha Sharir, Elad Verbin

Research output: Contribution to journalArticlepeer-review

44 Scopus citations


Let P be a sot of n points in ℝd, so that each point is colored by one of C given colors. We present algorithms for preprocessing P into a data structure that efficiently supports queries of the following form: Given an axis-parallel box Q, count the number of distinct colors of the points of P {n-ary intersection} Q. We present a general and relatively simple solution that has a polylogarithmic query time and worst-case storage about O(nd). It is based on several interesting structural properties of the problem, which we establish here. We also show that for random inputs, the data structure requires almost linear expected storage. We then present several techniques for achieving space-time tradeoff. In ℝ2, the most efficient solution uses fast matrix multiplication in the preprocessing stage. In higher dimensions we use simpler tradeoff mechanisms, which behave just as well. We give a reduction from matrix multiplication to the off-line version of problem, which shows that in ℝ2 our time-space tradeoffs are reasonably sharp, in the sense that improving them substantially would improve the best exponent of matrix multiplication. Finally, we present a generalized matrix multiplication problem and show its intimate relation to counting colors in boxes in higher dimension.,

Original languageEnglish
Pages (from-to)982-1011
Number of pages30
JournalSIAM Journal on Computing
Issue number3
StatePublished - 7 Nov 2008
Externally publishedYes


  • Colored orthogonal range counting
  • Generalized range searching
  • Matrix multiplication
  • Output-sensitive decomposition
  • Time-space tradeoff
  • Union of orthants

ASJC Scopus subject areas

  • General Computer Science
  • General Mathematics


Dive into the research topics of 'Efficient colored orthogonal range counting'. Together they form a unique fingerprint.

Cite this