Sublinear Geometric Algorithms
Sublinear Geometric Algorithms
Mikhail Dubov
Outline
1 Context
5 Applications
Outline
1 Context
5 Applications
Data preprocessing
Look at the whole data once, make
the subsequent queries fast
Example: Point location in Rk
One can build a k d-tree O(n)
in
Nearest neighbor search: O(log n)
per query on average
Data preprocessing
Look at the whole data once, make
the subsequent queries fast
Example: Point location in Rk
One can build a k d-tree O(n)
in
Nearest neighbor search: O(log n)
per query on average
Randomization
Look only at a portion of the data
Example: Point location in
Delaunay triangulations (stay tuned)
√
Expected O( n) time per query
without preprocessing
Our focus
Our focus
Our focus
Our focus
3 8 12
Outline
1 Context
5 Applications
Problem
Given a sorted doubly-linked list of n keys and a number x , nd the
smallest key y ≥ x (the successor of x ).
Problem
Given a sorted doubly-linked list of n keys and a number x , nd the
smallest key y ≥ x (the successor of x ).
Example:
3 8 12 31 34 38 62 97
succ(50) = 62
succ(12) = 12
Problem
Given a sorted doubly-linked list of n keys and a number x , nd the
smallest key y ≥ x (the successor of x ).
Problem
Given a sorted doubly-linked list of n keys and a number x , nd the
smallest key y ≥ x (the successor of x ).
Problem
Given a sorted doubly-linked list of n keys and a number x , nd the
smallest key y ≥ x (the successor of x ).
Problem
Given a sorted doubly-linked list of n keys and a number x , nd the
smallest key y ≥ x (the successor of x ).
Problem
Given a sorted doubly-linked list of n keys and a number x , nd the
smallest key y ≥ x (the successor of x ).
succ(50) =?
3 8 12 31 34 38 62 97
succ(50) =?
3 8 12 31 34 38 62 97
succ(50) =?
3 8 12 31 34 38 62 97
succ(50) =?
3 8 12 31 34 38 62 97
√
Algorithm: Randomized successor searching in O( n) time
Input : Doubly-linked list A = A[1] . . . A[n] of n numbers stored in
an array (table); number x
Output: The smallest√number y ∈ A s.t. y ≥ x (if exists)
1 Sample S ⊂ A, |S| = n, from A uniformly at random
2 p = argmaxi=1...√n S[i] s.t. S[i] ≤ x // predecessor in S
3 q = argmini=1... n S[i] s.t. S[i] ≥ x
√ // successor in S
4 s = argmini=p...s A[i] s.t. A[i] ≥ x // traverse A from p
5 return A[s]
√
Algorithm: Randomized successor searching in O( n) time
Input : Doubly-linked list A = A[1] . . . A[n] of n numbers stored in
an array (table); number x
Output: The smallest√number y ∈ A s.t. y ≥ x (if exists)
1 Sample S ⊂ A, |S| = n, from A uniformly at random
2 p = argmaxi=1...√n S[i] s.t. S[i] ≤ x // predecessor in S
3 q = argmini=1... n S[i] s.t. S[i] ≥ x
√ // successor in S
4 s = argmini=p...s A[i] s.t. A[i] ≥ x // traverse A from p
5 return A[s]
Theorem
√
Successor searching can be done in O( n) expected time per
query, which is optimal.
Theorem
√
Successor searching can be done in O( n) expected time per
query, which is optimal.
Proof
Some intuition:
√
Our sample S is a subset of n elements from A, |A| = n
√
We locate p and q in our sample in O(|S|) = O( n) time
The expected distance between these two elements is
√ √
|A|/|S| = n/ n = n
√
So traversing A[p] . . . A[q] takes O( n) expected time
Proof (Cont.)
√
Part I: Expected time is O( n).
Let A[s] be the desired successor
Proof (Cont.)
√
Part I: Expected time is O( n).
Let A[s] be the desired successor
Let S[k] be the nearest element to A among those in S
Proof (Cont.)
√
Part I: Expected time is O( n).
Let A[s] be the desired successor
Let S[k] be the nearest element to A among those in S
Event Qd : we don't hit any of A[s − d] . . . A[s + d] after
√
taking n random samples
Proof (Cont.)
√
Part I: Expected time is O( n).
Let A[s] be the desired successor
Let S[k] be the nearest element to A among those in S
Event Qd : we don't hit any of A[s − d] . . . A[s + d] after
√
taking n random samples
P(dist(A[s], S[k]) = d) = P(Qd−1 ) − P(Qd )
Proof (Cont.)
√
Part I: Expected time is O( n).
Let A[s] be the desired successor
Let S[k] be the nearest element to A among those in S
Event Qd : we don't hit any of A[s − d] . . . A[s + d] after
√
taking n random samples
P(dist(A[s], S[k]) = d) = P(Qd−1 ) − P(Qd )
X X
E(dist(A[s], S[k]) = i · (P(Qi−1 ) − P(Qi )) = P(Qi )
i≥1 i≥0
√ X √ X √ √
≤ n P(Qc √n ) ≤ n (1 − c/ n) n
c≥0 c≥0
√ X −c √
≤ n e = O( n)
c≥0
Proof (Cont.)
√
Part II: O( n) is optimal.
Yao's minimax principle:
Proof (Cont.)
√
Part II: O( n) is optimal.
Our model:
Input: a permutation σ of 1 . . . n, s.t. A[σ(i)] = i
Goal: nd succ(n)
Proof (Cont.)
√
Part II: O( n) is optimal.
Our model:
Input: a permutation σ of 1 . . . n, s.t. A[σ(i)] = i
Goal: nd succ(n)
Proof (Cont.)
√
Part II: O( n) is optimal.
Question:
√
On a random input, how likely is it to discover one of
the last n items after a operations A and b operations B?
Proof (Cont.)
√
Part II: O( n) is optimal.
Question:
√
On a random input, how likely is it to discover one of
the last n items after a operations A and b operations B?
B B A T T T
Proof (Cont.)
√
Part II: O( n) is optimal.
Question:
√
On a random input, how likely is it to discover one of
the last n items after a operations A and b operations B?
B B A T T T
Proof (Cont.)
√
Part II: O( n) is optimal.
Question:
√
On a random input, how likely is it to discover one of
the last n items after a operations A and b operations B?
B B A T T T
Proof (Cont.)
√
Part II: O( n) is optimal.
Question:
√
On a random input, how likely is it to discover one of
the last n items after a operations A and b operations B?
B B A T T T
Proof (Cont.)
√
Part II: O( n) is optimal.
Question:
√
On a random input, how likely is it to discover one of
the last n items after a operations A and b operations B?
B B A T T T
Proof (Cont.)
√
Part II: O( n) is optimal.
Question:
√
On a random input, how likely is it to discover one of
the last n items after a operations A and b operations B?
B B A T T T
Outline
1 Context
5 Applications
Problem
Given two convex polygons P and Q , with n vertices each,
determine whether they intersect or not and, if they do, report one
point in the intersection.
Problem
Given two convex polygons P and Q , with n vertices each,
determine whether they intersect or not and, if they do, report one
point in the intersection.
Example:
Intersection: YES
19 / 50 Mikhail Dubov Sublinear Geometric Algorithms
Context 1D: Successor searching 2D: Polygonal intersection 3D: Polyhedral intersection Applications References
Problem
Given two convex polygons P and Q , with n vertices each,
determine whether they intersect or not and, if they do, report one
point in the intersection.
Problem
Given two convex polygons P and Q , with n vertices each,
determine whether they intersect or not and, if they do, report one
point in the intersection.
Again, complexity depends on how polygons are stored:
Problem
Given two convex polygons P and Q , with n vertices each,
determine whether they intersect or not and, if they do, report one
point in the intersection.
Again, complexity depends on how polygons are stored:
1 General case
→ O(n) time (e.g. via Linear Programming, Seidel [1990])
Problem
Given two convex polygons P and Q , with n vertices each,
determine whether they intersect or not and, if they do, report one
point in the intersection.
Again, complexity depends on how polygons are stored:
1 General case
→ O(n) time (e.g. via Linear Programming, Seidel [1990])
Problem
Given two convex polygons P and Q , with n vertices each,
determine whether they intersect or not and, if they do, report one
point in the intersection.
Again, complexity depends on how polygons are stored:
1 General case
→ O(n) time (e.g. via Linear Programming, Seidel [1990])
Idea: allow for quick traversal between faces, edges, and vertices
due to the explicitly linked structure of the objects.
Idea: allow for quick traversal between faces, edges, and vertices
due to the explicitly linked structure of the objects.
Idea: allow for quick traversal between faces, edges, and vertices
due to the explicitly linked structure of the objects.
Winged edge
Also edge-based
For each edge, stores its vertices, left
and right faces etc.
Example
Example
Example
Example
Example
Case 2: RP ∩ CQ = ∅
Example
Example
Example
Theorem
To √
check whether two convex n-gons intersect can be done in
O( n) expected time, which is optimal.
Theorem
To √
check whether two convex n-gons intersect can be done in
O( n) expected time, which is optimal.
Proof
Some intuition:
For intersection tests at each step we use Linear Programming,
which works in O(r ) time for inputs of size r
√ √
After sampling n vertices from each n-gon, we have r = n
If the intersection test for our simplied polygons RP and RQ
fails, then the subsequent tests involving CP , CQ etc. will still
process a sublinear number of vertices
Proof (Cont.)
√
Part I: Expected time is O( n).
Assume we sample r vertices in the rst step
Proof (Cont.)
√
Part I: Expected time is O( n).
Assume we sample r vertices in the rst step
Running time is O(r + |CP | + |CP0 | + |CQ | + |CQ0 |) (follows
directly from the algorithm description, assuming we use LP
for intersection tests to execute them in linear time)
Proof (Cont.)
√
Part I: Expected time is O( n).
Assume we sample r vertices in the rst step
Running time is O(r + |CP | + |CP0 | + |CQ | + |CQ0 |) (follows
directly from the algorithm description, assuming we use LP
for intersection tests to execute them in linear time)
Key observation: one can show that E|CP | = O(n/r ); the
same is true for E|CP0 |, E|CQ | and E|CQ0 | (see the paper)
Proof (Cont.)
√
Part I: Expected time is O( n).
Assume we sample r vertices in the rst step
Running time is O(r + |CP | + |CP0 | + |CQ | + |CQ0 |) (follows
directly from the algorithm description, assuming we use LP
for intersection tests to execute them in linear time)
Key observation: one can show that E|CP | = O(n/r ); the
same is true for E|CP0 |, E|CQ | and E|CQ0 | (see the paper)
E(Running time) becomes O(r + n/r )
Proof (Cont.)
√
Part I: Expected time is O( n).
Assume we sample r vertices in the rst step
Running time is O(r + |CP | + |CP0 | + |CQ | + |CQ0 |) (follows
directly from the algorithm description, assuming we use LP
for intersection tests to execute them in linear time)
Key observation: one can show that E|CP | = O(n/r ); the
same is true for E|CP0 |, E|CQ | and E|CQ0 | (see the paper)
E(Running time) becomes O(r + n/r )
√ √
Setting r = n makes it O( n)
Proof (Cont.)
√
Part II: O( n) is optimal.
Yao's minimax principle =⇒ nd a dicult distribution:
Proof (Cont.)
√
Part II: O( n) is optimal.
Any algorithm that detects intersection must have access to q
to check that it lies in the origin
The only operations allowed are:
random sampling of edges
edge-traversing via links
The same argument as for the successor search problem
√
yields the Ω( n) bound
Outline
1 Context
5 Applications
Problem
Given two n-vertex convex polyhedra P and Q in R3 , determine
whether they intersect or not and, if they do, report one point in
the intersection.
Problem
Given two n-vertex convex polyhedra P and Q in R3 , determine
whether they intersect or not and, if they do, report one point in
the intersection.
Example:
Intersection: NO
38 / 50 Mikhail Dubov Sublinear Geometric Algorithms
Context 1D: Successor searching 2D: Polygonal intersection 3D: Polyhedral intersection Applications References
Problem
Given two n-vertex convex polyhedra P and Q in R3 , determine
whether they intersect or not and, if they do, report one point in
the intersection.
Problem
Given two n-vertex convex polyhedra P and Q in R3 , determine
whether they intersect or not and, if they do, report one point in
the intersection.
Problem complexity depends on the underlying data structures:
Problem
Given two n-vertex convex polyhedra P and Q in R3 , determine
whether they intersect or not and, if they do, report one point in
the intersection.
Problem complexity depends on the underlying data structures:
1 General case
→ O(n) time (via Linear Programming)
Problem
Given two n-vertex convex polyhedra P and Q in R3 , determine
whether they intersect or not and, if they do, report one point in
the intersection.
Problem complexity depends on the underlying data structures:
1 General case
→ O(n) time (via Linear Programming)
Problem
Given two n-vertex convex polyhedra P and Q in R3 , determine
whether they intersect or not and, if they do, report one point in
the intersection.
Problem complexity depends on the underlying data structures:
1 General case
→ O(n) time (via Linear Programming)
Example
Example
Example
Example
Example
Outline
1 Context
5 Applications
References I
References II