Data Structures: Range Queries - Space Efficiency Pooya Davoodi Aarhus University PhD Defense July 4, 2011
Dec 19, 2015
Data Structures:Range Queries - Space Efficiency
Pooya DavoodiAarhus University
PhD DefenseJuly 4, 2011
Thesis Overview Range Minimum Queries in Arrays
(ESA 2010, Invited to Algorithmica)
Path Minima Queries in Trees (WADS 2011)
Range Diameter Queries in 2D Point Sets (Submitted to ISAAC 2011)
Succinct -ary Trees(TAMC 2011)
2
57
44 2 3
4 6
1020
25 12 6 8 10 65 7 1312 43 76 31 17 62 9 514 23 18 79 84 10 8 404 6 98 45 11 38 58 25
c d e
b
f
a
Range Minimum Queries
Database systems– Lowest average-salary:
3
80,000 85,000 115,000 120,000 118,000
81,000 73,000 90,000 100,000 94,000
65,000 75,000 86,000 92,000 95,000
72,000 91,000 89,000 103,000 102,000
35,000 45,000 42,000 50,000 41,000
60
50
40
30
20
1990 1995 2000 2005 2010
Age
Year
Minimum:65,000 at [3,1]
Definition
Input: an array Query: where is minimum in ?
4
()
𝑛
𝑚𝑖1
𝑖2
𝑗1 𝑗2
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
query time Size of the table:
bits6
Top-Left 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
Tabulation12 85 10
1 2
1
2
Reference Space (bits) Query TimeTabulation
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-Efficient Data Structures
7
1D vs. 2D
1D: Cartesian Trees bits per element
(Tarjan et al., STOC’84) bits per element
(Sadakane, ISAAC’07)
2D: Nothing like Cartesian Trees
8
7 20 2 10 8 5 16 6
2
7
20 8
10
6
16
Lowest Common Ancestor
𝑚 bits per element(Our Result, ESA’10)
5
Indexing Data Structures
Popular in Succinct Data Structures
9
IndexRead-only
Input Array
bits
bits
bits
bits
Size of Input Size of Index Query Time
bits per element
(Our Results, ESA’10)
bits with query time
10
27 30 2 90 28 15 18 6
13 20 93 54 17 11 16 12
7 74 39 62 8 5 46 23
61 38 68 10 9 87 98 217 20 2 10 8 5 16 6
2
7
20
5
8
10
6
16
Cartesian Trees
log𝑚
Cartesian Tree:
log log𝑚
log log𝑛
Atallah and Yuan (SODA’10)
Tabulation
log𝑛
bits Per Element bits query time
bits query timeProof: queries distinguish inputs in timequery with time
11
1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 11 0 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 1 11 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 11 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 0 1 10 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 01 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1
C
Outline Range Minimum Queries
(ESA 2010, Invited to Algorithmica)
Path Minima Queries(WADS 2011)
Range Diameter Queries(Submitted to ISAAC 2011)
12
57
44 2
3
4 6
1020
25 12 6 8 10 65 7 1312 43 76 31 17 62 9 514 23 18 79 84 10 8 404 6 98 45 11 38 58 25
Path Minima/Maxima Queries The most expensive connection between two given nodes?
– between b and k = (c,e)– between e and k = (j,k)
Update(c,e) = 413
Tree-Topology Networks
30
a
b
d
ce
f gh
k
j
i
5
7
44 2
3
4
6
10
4
Trees with Dynamic Weights
4
Naïve Structures
Brute Force Search– Worst case query time: – Update time:
Tabulation– Query time: – Update time:
14
a
b
d
c e
f gh
k
j
i
5
7
44 2
3
46
10
30
30
Reduction from Range Minimum Queries in 1D arrays
Reference Query Time Update Time
Tabulation
Brute Force SearchSleator and Tarjan
(STOC’81)Our Result(WADS’11)
Our Result(WADS’11)
Dynamic Weights
15
𝐴 [1] 𝐴 [2] 𝐴 [3] 𝐴 [4 ] 𝐴 [5] 𝐴 [6]
Optimal: Brodal et al. (SWAT’96)
Optimal by conjecture:Patrascu and Thorup (STOC’06)Optimal: Alstrup et al. (FOCS’98)
ComparisonBased
RAM
Optimal: Alstrup et al. (FOCS’98)
Dynamic Leaves
16
Reference Query Time Update Time Comment
Alstrup and Holm (ICALP’00)and
Kaplan and Shafrir (ESA’08)RAM
Our Results(WADS’11)
Comparisonbased
Optimal: Pettie (FOCS’02)
a
b
d
c e
f gh
k
j
i
5
7
44 2
3
46
10
30
4
Updates with link and cut
17
a
b
d
c e
f gh
k
j
i
5
7
44 2
3
46
10
30
link (d,i,12)
cut(c,e)
12
Reference Query Time Update Time Comment
Sleator and Tarjan(STOC’81)
ComparisonBased
Our Results(WADS’11) Cell Probe
Proof: by reduction from connectivity problems in graphs
Outline Range Minimum Queries
(ESA 2010, Invited to Algorithmica)
Path Minima Queries(WADS 2011)
Range Diameter Queries(Submitted to ISAAC 2011)
18
57
44 2
3
4 6
1020
25 12 6 8 10 65 7 1312 43 76 31 17 62 9 514 23 18 79 84 10 8 404 6 98 45 11 38 58 25
Range Diameter Queries
Farthest pair of points
19
A Difficult Problem
Known Results
20
Cohen and Porat(2010)
Set Intersection Problem
Conjecture: Set Intersection problem is difficult(Patrascu and Roditty, FOCS’10)
Reference Query Time Space
Tabulation
Smid et al.(CCCG’08)
Our Results(Submitted to ISAAC’11) Reduction from Set Intersection
Set Intersection QueriesReduction
21
?
124
Diameter = 3 𝑆1∩𝑆2≠∅
Diameter < 5 𝑆1∩𝑆3=∅
Arithmetic on real numberswith unbounded precisions
Points in Convex Position
Our Results(Submitted to ISAAC’11)
Reference Query Time Space
Publications Range Minimum Queries
(ESA 2010, Invited to Algorithmica)
Path Minima Queries(WADS 2011)
Range Diameter Queries(Submitted to ISAAC 2011)
Succinct -ary Trees(TAMC 2011)
22
57
44 2
3
4 6
1020
25 12 6 8 10 65 7 1312 43 76 31 17 62 9 514 23 18 79 84 10 8 404 6 98 45 11 38 58 25
c d e
b
f
a