www.cs.au.dk
Download
Report
Transcript www.cs.au.dk
Data Structures:
Range Queries - Space Efficiency
Pooya Davoodi
Aarhus University
PhD Defense
July 4, 2011
Thesis Overview
25
12
14
4
ο§ Range Minimum Queries in Arrays
(ESA 2010, Invited to Algorithmica)
ο§ Path Minima Queries in Trees
(WADS 2011)
6
76
18
98
8
31
79
45
20
7
5
12
43
23
6
4
10
17
84
11
65
62
10
38
7
9
8
58
13
5
40
25
46
4 2 3 10
ο§ Range Diameter Queries in 2D Point Sets
(Submitted to ISAAC 2011)
a
ο§ Succinct π-ary Trees
c
(TAMC 2011)
b
d e
f
2
Range Minimum Queries
ο§ Database systems
β Lowest average-salary:
Year
Age
1990
1995
2000
2005
2010
60
80,000
85,000
115,000
120,000
118,000
50
81,000
73,000
90,000
100,000
94,000
40
65,000
75,000
86,000
92,000
95,000
30
72,000
91,000
89,000
103,000
102,000
20
35,000
45,000
42,000
50,000
41,000
Minimum:
65,000 at [3,1]
3
Definition
ο§ Input: an array π΄ = 1 . . π × 1. . π
(π β€ π)
ο§ Query: where is minimum in π1 . . π2 × π1 . . π2 ?
π
π1
π
π2
π1
π2
4
Naïve Solution
ο§ Brute force search
ο§ Query time: π(π β π β²) time
ο§ Worst case : π(π) time (π = π β π)
π
π β²
π
π
5
Data Structures
ο§ Preprocess and store some information
ο§ Naïve: store the answers of all queries
Top-Left
1
2
1
2
12
5
8
10
Tabulation
ο§ π(1) query time
ο§ Size of the table:
π(π 2 log π) bits
Bottom-Right Minimum
(1,1)
(1,1)
(1,1): 12
(1,1)
(1,2)
(1,2): 8
(1,1)
(2,1)
(2,1): 5
(1,1)
(2,2)
(2,1): 5
(2,1)
(2,1)
(2,1): 5
(2,1)
(2,2)
(2,2): 5
(1,2)
(1,2)
(1,2): 8
(1,2)
(2,2)
(1,2): 8
(2,2)
(2,2)
(2,2): 10
6
Space-Efficient Data Structures
Reference
Tabulation
Tarjan et al.
(STOCβ84)
Chazelle & Rosenberg
(SoCGβ89)
Lewenstein et al.
(CPMβ07)
Demaine et al.
(ICALPβ09)
Sadakane
(ISAACβ07)
Our Result
(ESAβ10)
Our Result
(ESAβ10)
Space (bits)
π π 2 log π
Query Time
π 1
π π log 2 π
π log π
π π log π
π πΌ π
π π log π
(π β€ π)
Ξ© π log π
(π = π)
π π
(π = 1)
Ξ© π log π
(π β€ π)
π π β min π, log π
(π β€ π)
2
π 1
π 1
-
π 1
7
1D vs. 2D
ο§ 1D: Cartesian Trees
7
ο§ π(log π) bits per element
5
20
8
(Tarjan et al., STOCβ84)
6
10
ο§ π(1) bits per element
(Sadakane, ISAACβ07)
Lowest Common Ancestor
2
7
20
2
10
16
8
5
16
6
ο§ 2D: Nothing like Cartesian Trees
Ξ©(log π) bits per element π
(Our Result, ESAβ10)
8
Indexing Data Structures
ο§ Popular in Succinct Data Structures
Read-only
Index
Input Array
π×π=π
π(1)
π
π π bits
π log π bits
Size of Input
1
π
bits per element
π(1)
π
π
π
bits
π(π log 2 π)
π
π
π
bits
Ξ©(π)
Size of Index
Query Time
(Our Results, ESAβ10)
9
π(π) bits with π(1) query time
27 30
2
90 28 15 18
6
13 20 93 54 17 11 16 12
7
74 39 62
61 38 68 10
8
9
5
2
46 23
7
5
20
Cartesian Trees
8
6
16
10
87 98 21
7
20
2
10
8
5
16
6
Cartesian Tree:
log log π
log log π
log π
log π
Tabulation
Atallah and Yuan (SODAβ10)
10
π
ο§ π/π bits
ο§ π/π bits
1
bits Per Element
π
π(π log 2 π) query time
Ξ©(π) query time
ο§ Proof: π/π queries distinguish inputs in Ξ©(π) time
ο§ βquery with Ξ©(π) time
C
1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1
1 0 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1
1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1
1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1
0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 0
1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1
11
Outline
ο§ Range Minimum Queries
25
12
14
4
(ESA 2010, Invited to Algorithmica)
ο§ Path Minima Queries
(WADS 2011)
6
76
18
98
8
31
79
45
20
7
5
12
43
23
6
4
10
17
84
11
65
62
10
38
4
42
7
9
8
58
6
3
13
5
40
25
10
ο§ Range Diameter Queries
(Submitted to ISAAC 2011)
12
Path Minima/Maxima Queries
ο§ The most expensive connection between two given nodes?
β between b and k = (c,e)
i
β between e and k = (j,k)
4
7
b
5
a
30 4
c
4
4
6
e
2
f
d
g
j
3
h
10
k
Tree-Topology Networks
ο§ Update(c,e) = 4
Trees with Dynamic Weights
13
Naïve Structures
ο§ Brute Force Search
β Worst case query time: π(π)
β Update time: π(1)
b
7
5
a
c
i
4
30
e
6
4 2 3
h
g
f
4
d
j
10
k
ο§ Tabulation
β Query time: π(1)
β Update time: π(π2 )
30 4
14
Dynamic Weights
Reference
Query Time
Update Time
Tabulation
π 1
π π2
Brute Force Search
π π
π 1
Sleator and Tarjan
(STOCβ81)
π log π
π
Our Result
(WADSβ11)
π log π
log π
log log π
Comparison
Based
π(log π)
Optimal: Alstrup et al. (FOCSβ98) Optimal: Brodal et al. (SWATβ96)
π
Our Result
(WADSβ11)
log π
log log π
π
log π
log log π
Optimal by conjecture:
Optimal: Alstrup et al. (FOCSβ98) Patrascu and Thorup (STOCβ06)
RAM
ο§ Reduction from Range Minimum Queries in 1D arrays
π΄[1]
π΄[2]
π΄[3]
π΄[4]
π΄[5]
π΄[6]
15
Dynamic Leaves
Reference
Query
Time
Update Time
Comment
Alstrup and Holm (ICALPβ00)
and
Kaplan and Shafrir (ESAβ08)
π(1)
π(1)
RAM
Our Results
(WADSβ11)
π πΌ(π)
π(1)
Comparison
based
Optimal: Pettie (FOCSβ02)
i
4
b
5
a
7
c
4
d
30
e
6
4 2 3
h
g
f
j
10 4
k
16
Updates with link and cut
i
cut(c,e)
link (d,i,12)
Reference
Sleator and Tarjan
(STOCβ81)
Our Results
(WADSβ11)
b
5
a
7
30
c
4
e
6
4 2 3
h
g
f
12
d
Query Time
4
Update
Time
π log π
π log π
Ξ©(log π)
π(log π)
log π
Ξ©(
)
log log π
π(log π π)
j
10
k
Comment
Comparison
Based
Cell Probe
Proof: by reduction from connectivity problems in graphs
17
Outline
ο§ Range Minimum Queries
25
12
14
4
(ESA 2010, Invited to Algorithmica)
ο§ Path Minima Queries
(WADS 2011)
6
76
18
98
8
31
79
45
20
7
5
12
43
23
6
4
10
17
84
11
65
62
10
38
4
42
7
9
8
58
6
3
13
5
40
25
10
ο§ Range Diameter Queries
(Submitted to ISAAC 2011)
18
Range Diameter Queries
ο§ Farthest pair of points
A Difficult Problem
19
Known Results
Reference
Query Time
Space
Tabulation
π log π
π π4
Smid et al.
(CCCGβ08)
π log 6 π
π π2
π
Our Results
(Submitted to ISAACβ11)
π log π
π π
Reduction from Set Intersection
Set Intersection Problem
Cohen and Porat
(2010)
π log π
π
π log π
π π2
π π
Conjecture: Set Intersection problem is difficult
(Patrascu and Roditty, FOCSβ10)
20
Set Intersection Queries
Reduction
π1 = 0.5,1,2
π2 = 1,1.5, 3
π3 = 0.2,3
ππ β© ππ = β
?
4
2 1
π1 β© π2 β β
π1 β© π3 = β
Diameter = 3
π1 β© π2 β β
Diameter < 5
π1 β© π3 = β
Arithmetic on real numbers
with unbounded precisions
Reference
Query Time
Space
Points in Convex Position
Our Results
(Submitted to ISAACβ11)
π log π
π π log π
21
Publications
ο§ Range Minimum Queries
25
12
14
4
(ESA 2010, Invited to Algorithmica)
ο§ Path Minima Queries
12
43
23
6
(WADS 2011)
8
31
79
45
10
17
84
11
20
7
5
6
76
18
98
4
65
62
10
38
7
9
8
58
4
42
13
5
40
25
6
3
10
ο§ Range Diameter Queries
(Submitted to ISAAC 2011)
a
ο§ Succinct π-ary Trees
b
c de
(TAMC 2011)
f
22