On Dynamic Range Reporting in One Dimension Christian Mortensen 1 - - PowerPoint PPT Presentation

on dynamic range reporting in one dimension
SMART_READER_LITE
LIVE PREVIEW

On Dynamic Range Reporting in One Dimension Christian Mortensen 1 - - PowerPoint PPT Presentation

On Dynamic Range Reporting in One Dimension Christian Mortensen 1 Rasmus Pagh 1 cu 2 Mihai P atras 1 IT U. Copenhagen 2 MIT STOC May 22, 2005 Mortensen, Pagh, P atras cu On Dynamic Range Reporting in One Dimension Range Reporting


slide-1
SLIDE 1

On Dynamic Range Reporting in One Dimension

Christian Mortensen1 Rasmus Pagh1 Mihai Pˇ atras ¸cu2

1IT U. Copenhagen 2MIT

STOC – May 22, 2005

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-2
SLIDE 2

Range Reporting in 1D

Maintain a set S, |S| = n, under:

INSERT(x): S ← S ∪ {x} DELETE(x): S ← S \ {x} REPORT(a, b): return S ∩ [a, b]

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-3
SLIDE 3

Range Reporting in 1D

Maintain a set S, |S| = n, under:

INSERT(x): S ← S ∪ {x} DELETE(x): S ← S \ {x} REPORT(a, b): return S ∩ [a, b]

Model: Word RAM, w-bit words S ⊂ {0, . . . , 2w − 1}

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-4
SLIDE 4

Range Reporting in 1D

Maintain a set S, |S| = n, under:

INSERT(x): S ← S ∪ {x} DELETE(x): S ← S \ {x} REPORT(a, b): return S ∩ [a, b]

Alternative query

FINDANY(a, b): return any y ∈ S ∩ [a, b], or EMPTY

Updates maintain S in sorted order. Then, just scan left or right starting with y. Model: Word RAM, w-bit words S ⊂ {0, . . . , 2w − 1}

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-5
SLIDE 5

Search Problems

Exact Search

MEMBER(x) : is x ∈ S?

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-6
SLIDE 6

Search Problems

Predecessor Search

PRED(x) : return max{y ∈ S | y ≤ x}

Exact Search

MEMBER(x) : is x ∈ S?

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-7
SLIDE 7

Search Problems

Predecessor Search

PRED(x) : return max{y ∈ S | y ≤ x}

PRED(b)

Range Reporting in 1D

FINDANY(a, b) : return any y ∈ S ∩ [a, b]

FINDANY(x, x)

Exact Search

MEMBER(x) : is x ∈ S?

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-8
SLIDE 8

Search Problems

Range Reporting in 2D

EMPTY([a, b] × [c, d]) : is S ∩ ([a, b] × [c, d]) = ∅?

“colored predecessor problem”

Predecessor Search

PRED(x) : return max{y ∈ S | y ≤ x}

PRED(b)

Range Reporting in 1D

FINDANY(a, b) : return any y ∈ S ∩ [a, b]

FINDANY(x, x)

Exact Search

MEMBER(x) : is x ∈ S?

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-9
SLIDE 9

Hardness of Range Reporting

Predecessor search: Ω( lg w

lg lg w ) per query, even statically

O(lg w) per query/update: van Emde Boas recursion.

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-10
SLIDE 10

Hardness of Range Reporting

Predecessor search: Ω( lg w

lg lg w ) per query, even statically

O(lg w) per query/update: van Emde Boas recursion. Static range reporting MAGIC: O(1) query [MNSW – STOC’95] . . . and O(n) space [ABR – STOC’01]

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-11
SLIDE 11

Hardness of Range Reporting

Predecessor search: Ω( lg w

lg lg w ) per query, even statically

O(lg w) per query/update: van Emde Boas recursion. Static range reporting MAGIC: O(1) query [MNSW – STOC’95] . . . and O(n) space [ABR – STOC’01] Dynamize these solutions ⇒ tradeoff: O(wε) per update, O(1) per query

  • O(lg w) per update, O(lg w) per query

Not so magical: converges to van Emde Boas.

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-12
SLIDE 12

Dynamic MAGIC

We achieve: O(lg w) updates O(lg lg w) queries O(n) space

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-13
SLIDE 13

Dynamic MAGIC

We achieve: O(lg w) updates need predecessor query if S is maintained sorted O(lg lg w) queries O(n) space

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-14
SLIDE 14

Dynamic MAGIC

We achieve: O(lg w) updates need predecessor query if S is maintained sorted O(lg lg w) queries exponential improvement over van Emde Boas in terms of universe size u, this is O(lg lg lg u) O(n) space

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-15
SLIDE 15

Dynamic MAGIC

We achieve: O(lg w) updates need predecessor query if S is maintained sorted O(lg lg w) queries exponential improvement over van Emde Boas in terms of universe size u, this is O(lg lg lg u) O(n) space MAGICAL ingredients:

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-16
SLIDE 16

Dynamic MAGIC

We achieve: O(lg w) updates need predecessor query if S is maintained sorted O(lg lg w) queries exponential improvement over van Emde Boas in terms of universe size u, this is O(lg lg lg u) O(n) space MAGICAL ingredients: eye of a newt

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-17
SLIDE 17

Dynamic MAGIC

We achieve: O(lg w) updates need predecessor query if S is maintained sorted O(lg lg w) queries exponential improvement over van Emde Boas in terms of universe size u, this is O(lg lg lg u) O(n) space MAGICAL ingredients: eye of a newt bat wing

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-18
SLIDE 18

Dynamic MAGIC

We achieve: O(lg w) updates need predecessor query if S is maintained sorted O(lg lg w) queries exponential improvement over van Emde Boas in terms of universe size u, this is O(lg lg lg u) O(n) space MAGICAL ingredients: eye of a newt bat wing new, subtle recursion idea

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-19
SLIDE 19

Dynamic MAGIC

We achieve: O(lg w) updates need predecessor query if S is maintained sorted O(lg lg w) queries exponential improvement over van Emde Boas in terms of universe size u, this is O(lg lg lg u) O(n) space MAGICAL ingredients: eye of a newt bat wing new, subtle recursion idea dynamic perfect hashing in sublinear space

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-20
SLIDE 20

Van Emde Boas Recursion

y x

Binary search for longest common prefix of x and PRED(x).

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-21
SLIDE 21

Van Emde Boas Recursion

x y x y

Binary search for longest common prefix of x and PRED(x).

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-22
SLIDE 22

Van Emde Boas Recursion

x y x y x y

Binary search for longest common prefix of x and PRED(x).

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-23
SLIDE 23

Van Emde Boas Recursion

x y x y x y

Binary search for longest common prefix of x and PRED(x). Interpret integers at different levels of detail.

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-24
SLIDE 24

Van Emde Boas Recursion

x y x y x y

Binary search for longest common prefix of x and PRED(x). Interpret integers at different levels of detail. van Emde Boas examines levels of detail sequentially

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-25
SLIDE 25

Van Emde Boas Recursion

x y x y x y

Binary search for longest common prefix of x and PRED(x). Interpret integers at different levels of detail. van Emde Boas examines levels of detail sequentially we do a binary search on the levels of detail

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-26
SLIDE 26

What are we searching for?

Interpret S as paths in trie of height w ⇒ n − 1 branching nodes

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-27
SLIDE 27

What are we searching for?

Interpret S as paths in trie of height w ⇒ n − 1 branching nodes 4 interesting values per branching node

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-28
SLIDE 28

What are we searching for?

b a

Interpret S as paths in trie of height w ⇒ n − 1 branching nodes 4 interesting values per branching node

FINDANY(a, b)

compute LCA(a, b) find lowest branching ancestor of the LCA check if any extreme point is in [a, b]

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-29
SLIDE 29

Lowest branching ancestor?

Trouble: finding the lowest branching ancestor of arbitrary v is as hard as predecessor search

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-30
SLIDE 30

Lowest branching ancestor?

Trouble: finding the lowest branching ancestor of arbitrary v is as hard as predecessor search But we don’t always need to find it

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-31
SLIDE 31

Lowest branching ancestor?

Trouble: finding the lowest branching ancestor of arbitrary v is as hard as predecessor search But we don’t always need to find it Assume v is on an active path: if true, find ancestor faster if false, fail

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-32
SLIDE 32

Lowest branching ancestor?

Trouble: finding the lowest branching ancestor of arbitrary v is as hard as predecessor search But we don’t always need to find it Assume v is on an active path: if true, find ancestor faster if false, fail Happens only when S ∩ [a, b] = ∅ ⇒ witness verification catches the error

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-33
SLIDE 33

Binary search on levels of detail

Binary search for level L such that:

v v Level L − 1: branching Level L: no branching

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-34
SLIDE 34

Binary search on levels of detail

Binary search for level L such that: O(lg lg w)

v v Level L − 1: branching Level L: no branching

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-35
SLIDE 35

Binary search on levels of detail

Binary search for level L such that: O(lg lg w)

v

w

v Level L − 1: branching Level L: no branching

Then, w holds pointer to lowest branching ancestor. Nice, but can we update?

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-36
SLIDE 36

Binary search on levels of detail

Binary search for level L such that: O(lg lg w)

v

w

v Level L − 1: branching Level L: no branching

Then, w holds pointer to lowest branching ancestor. Nice, but can we update? at level L, must have branching immediately above

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-37
SLIDE 37

Binary search on levels of detail

Binary search for level L such that: O(lg lg w)

v

w

v Level L − 1: branching Level L: no branching

Then, w holds pointer to lowest branching ancestor. Nice, but can we update? at level L, must have branching immediately above so ancestor in same “triangle” as w on level L

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-38
SLIDE 38

Binary search on levels of detail

Binary search for level L such that: O(lg lg w)

v

w

v Level L − 1: branching Level L: no branching

Then, w holds pointer to lowest branching ancestor. Nice, but can we update? at level L, must have branching immediately above so ancestor in same “triangle” as w on level L for each branching node, ≤ 2 pointers to it at every level

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-39
SLIDE 39

Binary search on levels of detail

Binary search for level L such that: O(lg lg w)

v

w

v Level L − 1: branching Level L: no branching

Then, w holds pointer to lowest branching ancestor. Nice, but can we update? O(lg w) at level L, must have branching immediately above so ancestor in same “triangle” as w on level L for each branching node, ≤ 2 pointers to it at every level

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-40
SLIDE 40

Achieving O(n) space

Space: O(lg w) pointers to O(n) branching nodes But can encode as level pointers: O(lg w) bits each ⇒ O(n lg2 w) bits of “real information” = o(n) words.

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-41
SLIDE 41

Achieving O(n) space

Space: O(lg w) pointers to O(n) branching nodes But can encode as level pointers: O(lg w) bits each ⇒ O(n lg2 w) bits of “real information” = o(n) words. Bloomier filters: store vector A[1 . . U] of r-bit values

  • nly N ≪ U nonzero positions

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-42
SLIDE 42

Achieving O(n) space

Space: O(lg w) pointers to O(n) branching nodes But can encode as level pointers: O(lg w) bits each ⇒ O(n lg2 w) bits of “real information” = o(n) words. Bloomier filters: store vector A[1 . . U] of r-bit values

  • nly N ≪ U nonzero positions

N = O(n lg w), U = O(2w), r = O(lg w)

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-43
SLIDE 43

Achieving O(n) space

Space: O(lg w) pointers to O(n) branching nodes But can encode as level pointers: O(lg w) bits each ⇒ O(n lg2 w) bits of “real information” = o(n) words. Bloomier filters: store vector A[1 . . U] of r-bit values

  • nly N ≪ U nonzero positions

N = O(n lg w), U = O(2w), r = O(lg w) Space lower bound: ∼ N(r + lg U) bits ∼ N words.

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-44
SLIDE 44

Achieving O(n) space

Space: O(lg w) pointers to O(n) branching nodes But can encode as level pointers: O(lg w) bits each ⇒ O(n lg2 w) bits of “real information” = o(n) words. Bloomier filters: store vector A[1 . . U] of r-bit values

  • nly N ≪ U nonzero positions

N = O(n lg w), U = O(2w), r = O(lg w) Space lower bound: ∼ N(r + lg U) bits ∼ N words. Allow one-sided error: if A[i] = 0, answer must be correct if A[i] = 0, answer can be wrong

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-45
SLIDE 45

Low-Space Structures

First sublinear-space solution to dynamic Bloomier filters: O(n(r + lg lg u)) bits Via first sublinear-space solution to dynamic perfect hashing We prove matching lower bounds improves [CKRT – SODA’04]

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-46
SLIDE 46

Almost done. . .

Story Time

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension

slide-47
SLIDE 47

Almost done. . .

Story Time T HE END

Mortensen, Pagh, Pˇ atras ¸cu On Dynamic Range Reporting in One Dimension