Lower Bounds for 2-Dimensional Range Counting

30
Lower Bounds for 2-Dimensional Range Counting Mihai Pătraşcu summer @

description

Lower Bounds for 2-Dimensional Range Counting. Mihai P ătraşcu. summer @. Range Counting. SELECT count(*) FROM employees WHERE salary

Transcript of Lower Bounds for 2-Dimensional Range Counting

Page 1: Lower Bounds for  2-Dimensional Range Counting

Lower Bounds for 2-Dimensional Range Counting

Mihai Pătraşcu

summer @

Page 2: Lower Bounds for  2-Dimensional Range Counting

Range Counting

SELECT count(*)FROM employeesWHERE salary <= 70000 AND startdate <= 1998

’98 ’99’97 ’96

70000

69000

68000

71000

Page 3: Lower Bounds for  2-Dimensional Range Counting

Some Theory

• d dimensions• range trees (roughly):

space S=nlgd-1n, query t=lgd-1n• space S=n2d, query t=O(1)

• geometric extensions: range = disks, half-spaces, polygons…

PROBLEM: lower bounds

Page 4: Lower Bounds for  2-Dimensional Range Counting

The Semigroup Industry

Let (U,+) be a semigroup

Points have weights in U

Given w1,…,wn:

precompute S sums

query:

add t precomputed sums

w1

w2

w4

w5

w6

w7w3

w1+w2+w4+w5

Page 5: Lower Bounds for  2-Dimensional Range Counting

Why “Industry”?

• tight semigroup lower bounds [Fredman JACM’81] [Chazelle FOCS’86]

• many, many excellent bounds for many range problems

Why are we so good at this?

[Caravaggio]

Page 6: Lower Bounds for  2-Dimensional Range Counting

Semigroup = Low Dimension

• say Mem[17]=w2+w6

• can Mem[17] help with this query?

NO: cannot subtract w6

• Mem[17] described by bounding boxcan only be used when query dominates bounding box

“How well do rectangles decompose into rectangles?” X (disks, half-planes…) Y

w1 w2

w4

w5

w6

w7w3

All these objects are low-dimensional!

Page 7: Lower Bounds for  2-Dimensional Range Counting

Computation = High Dimension

New concept…

weights come from a group (U,+,-)

• can cancel any weight => no bounding box• relevant information about Mem[17]:

O(1)-D rectangle → linear combination of n variables

• decomposability in O(1)-D → decomposability in n-D

• n-D means: geometry → information theory

Page 8: Lower Bounds for  2-Dimensional Range Counting

The Ultimate Frontier

The cell-probe model:• plain old counting (weights 0,1)• each cell stores any function of inputs• query probes t cells (adaptively), computes any function

“Theory of the computer in your lap”

Page 9: Lower Bounds for  2-Dimensional Range Counting

To boldly go where no one has gone before

General lack of group lower bounds

(never mind cell-probe!)[Chazelle STOC’95] Ω(lglg n)

[Fredman JACM’82]

[Chazelle FOCS’86]

[Agarwal ’9x, ’0x]

etc etc

yeah, we have nice semigroup lower boundsbut prove something in the group model

Page 10: Lower Bounds for  2-Dimensional Range Counting

Our Small Step

If S=n lgO(1)n, then t=Ω(lg n / lglg n)

group model! …and cell-probe model! tight in 2D

Maybe not so giant leap for mankind… does not grow with d

=> really only relevant for 2D

Page 11: Lower Bounds for  2-Dimensional Range Counting

Basic Idea

Remember:

Separating linear from polynomial space:

[P,Thorup STOC’06] Ω(lglg n)[P,Thorup SODA’06] --”-- randomized

[P,Thorup FOCS’06] Ω(lg n / lglg n)(“unnatural” problems; not tight)

NOW Ω(lg n / lglg n)(natural, fundamental problem; tight)

• space S=nlgd-1n, query t=lgd-1n• space S=n2d, query t=O(1)

“technique”

“framework”

“trick”

The trick:“Consider n / lg n queries, see what happens”

This paper: what happens for range counting

Page 12: Lower Bounds for  2-Dimensional Range Counting

Hard Instance

The bit-reversal permutation (see FFT, etc):

e.g. π(6) = π(“110”) = “011” = 3

Well-known hard instance:• points at (x, π(x))• random query [0,a] X [0,b]

[in fact, many independent random queries]

x 0 1 2 3 4 5 6 7

π(x) 0 4 2 6 1 5 3 7

Page 13: Lower Bounds for  2-Dimensional Range Counting

The Shuffle View

00

11

22

33

44

55

66

77

Page 14: Lower Bounds for  2-Dimensional Range Counting

77

663

311

The Shuffle View

00

11

22

33

44

55

66

77

00

22 5

5

44

Page 15: Lower Bounds for  2-Dimensional Range Counting

77

663

311

The Shuffle View

00

11

22

33

44

55

66

77

00

22 5

5

44

Page 16: Lower Bounds for  2-Dimensional Range Counting

77

55

77

663

311

The Shuffle View

00

11

22

33

44

55

66

77

00

22 5

5

44

663

3

11

22

44

00

Page 17: Lower Bounds for  2-Dimensional Range Counting

77

55

77

663

311

The Shuffle View

00

11

22

33

44

55

66

77

00

22 5

5

44

663

3

11

22

44

00

Page 18: Lower Bounds for  2-Dimensional Range Counting

77

33

55

11

77

55

77

663

311

The Shuffle View

00

11

22

33

44

55

66

77

00

22 5

5

44

663

3

11

22

44

00

66

22

44

00

Page 19: Lower Bounds for  2-Dimensional Range Counting

77

33

55

11

77

55

77

663

311

The Shuffle View

00

11

22

33

44

55

66

77

00

22 5

5

44

663

3

11

22

44

00

66

22

44

00

x 0 1 2 3 4 5 6 7

π(x) 0 4 2 6 1 5 3 7

Page 20: Lower Bounds for  2-Dimensional Range Counting

77

33

55

11

77

55

77

663

311

The Shuffle View

00

11

22

33

44

55

66

77

00

22 5

5

44

663

3

11

22

44

00

66

22

44

00

x 0 1 2 3 4 5 6 7

π(x) 0 4 2 6 1 5 3 7

4

123

5678

Page 21: Lower Bounds for  2-Dimensional Range Counting

77

33

55

11

77

55

77

663

311

The Shuffle View

00

11

22

33

44

55

66

77

00

22 5

5

44

663

3

11

22

44

00

66

22

44

00

x 0 1 2 3 4 5 6 7

π(x) 0 4 2 6 1 5 3 7

4

123

5678

Page 22: Lower Bounds for  2-Dimensional Range Counting

77

33

55

11

77

55

77

663

311

The Shuffle View

00

11

22

33

44

55

66

77

00

22 5

5

44

663

3

11

22

44

00

66

22

44

00

x 0 1 2 3 4 5 6 7

π(x) 0 4 2 6 1 5 3 7

4

123

5678

Page 23: Lower Bounds for  2-Dimensional Range Counting

Shuffling the Queries

00

11

22

33

44

55

66

77

x 0 1 2 3 4 5 6 7

π(x) 0 4 2 6 1 5 3 7

query [0,4] X [0,5]

4

123

5678

Page 24: Lower Bounds for  2-Dimensional Range Counting

Shuffling the Queries

00

11

22

33

44

55

66

77

x 0 1 2 3 4 5 6 7

π(x) 0 4 2 6 1 5 3 7

query [0,5] X [0,4]

77

663

311

00

22 5

5

44

123

5678

4

Page 25: Lower Bounds for  2-Dimensional Range Counting

77

663

311

Shuffling the Queries

00

11

22

33

44

55

66

77

00

22

x 0 1 2 3 4 5 6 7

π(x) 0 4 2 6 1 5 3 7

query [0,5] X [0,4]

55

44

77

553

3

11

22

00

66

44

4

123

5678

Page 26: Lower Bounds for  2-Dimensional Range Counting

4

123

5678

77

55

77

663

311

Shuffling the Queries

00

11

22

33

44

55

66

77

00

22

33

11

22

00

x 0 1 2 3 4 5 6 7

π(x) 0 4 2 6 1 5 3 7

query [0,5] X [0,4]

55

44

66

44

77

33

55

11

66

22

44

00

Specifying a query=

Saying how it shuffles at every level

Page 27: Lower Bounds for  2-Dimensional Range Counting

Proof Sketch (I)

• k queries, space S=> one probe revels lg = Θ(k lg(S/k))

bits of information about the queries• t probes => Θ(tk lg(S/k)) bits

• k=n / lg n S=n lgO(1)n t=o(lg

n / lglg n)=> o(k lg n) bitsrevealed by the probes about the queries

Sk

Page 28: Lower Bounds for  2-Dimensional Range Counting

Proof Sketch (II)

• I(queries) ≤ I(shuffling at level 1) + I(shuffling at level 2) + …

+ I(shuffling at level lg n) ≤ o(k lg n)

• so for one level the data structure learns o(k) bits of information about the queries

[i.e. doesn’t know where most queries fit]

• so it cannot precompute useful sums[see Proceedings]

Page 29: Lower Bounds for  2-Dimensional Range Counting

D

D D

N

N N

E

E E

T

T T

H

H H

E

E E

Page 30: Lower Bounds for  2-Dimensional Range Counting

1515

1313

1414

1515

1313

1111

88

99

1010

1111

1212

1313

1414

1515

99

1010

1212

1414

88

1111

99

1010

1212

88

1515

1313

141411

11

99

1010

1212

88