Download presentation
Presentation is loading. Please wait.
1
10/2/20061 Algorithms on grids Natasha Gelfand Geometry Seminar Fall 2006
2
10/2/2006Geometry Seminar: Algorithms on Grids2 Grids in computer science
3
10/2/2006Geometry Seminar: Algorithms on Grids3 Grids in computer science Graphics and vision Collision detection, point location Simulation
4
10/2/2006Geometry Seminar: Algorithms on Grids4 Grids for geometric proximity Isolate and localize interesting events –Proximity is local “Uniform” grids –Closest pair, k -Minimum enclosing disk Adaptive grids –quadtrees
5
10/2/2006Geometry Seminar: Algorithms on Grids5 Closest pair Given: n points in the plane Return pair of points realizing
6
10/2/2006Geometry Seminar: Algorithms on Grids6 Computing the grid takes linear time Grids for points
7
10/2/2006Geometry Seminar: Algorithms on Grids7 Sub-problem Given a set P and a distance r, verify in linear time if CP(P) r –Insert points sequentially –If CP(P) < r, p, q are in the same or neighboring cells –Can we search a cell in constant time? r
8
10/2/2006Geometry Seminar: Algorithms on Grids8 Algorithm If some cell contains more than 9 points, then CP(P)<r Algorithm: –Insert points into the grid –If cell(p) contains more than 9 points, return CP(P) < r
9
10/2/2006Geometry Seminar: Algorithms on Grids9 Algorithm If some cell contains more than 9 points, then CP(P)<r Algorithm: –Insert points into the grid –If cell(p) contains more than 9 points, return CP(P) < r –Otherwise, compute Constant time per point, running time O(n) r
10
10/2/2006Geometry Seminar: Algorithms on Grids10 Closest pair Permute points P= Let r i = CP({p 1, …, p i }) –Can check if r i <r i-1 in linear time Good case: r i = r i-1 –Grid is already built, check in O(1) time Bad case: r i < r i-1 –Rebuild grid, O(i) time Trivial bound: O(nk), when closest pair changes k times
11
10/2/2006Geometry Seminar: Algorithms on Grids11 Analysis Let X i = 1 if r i · r i-1, and 0 otherwise Running time:
12
10/2/2006Geometry Seminar: Algorithms on Grids12 Analysis Bound Pr[X i = 1 ] = Pr[r i < r i-1 ] –Likelihood that p i realizes CP(P i ) Expected running time
13
10/2/2006Geometry Seminar: Algorithms on Grids13 k -Enclosing minimum disk Disk of minimum radius that contains k points Brute force O(n k ) 2- Opt algorithm: r(P,k) · 2r opt (P,k) k=3 k=4
14
10/2/2006Geometry Seminar: Algorithms on Grids14 Non-uniform grid Partition P into horizontal strips with at most k/4 points in each strip –Recursive median partitioning –O(n/k) strips G Running time: T(n) = n + 2T(n/2 ) Stop at n < k/4 O(nlog(n/k))
15
10/2/2006Geometry Seminar: Algorithms on Grids15 Finite centers Claim: D opt (P,k) contains at least one intersection point of G Pf: By contradiction: At most k/2 points D opt (P,k) k/4 points k points
16
10/2/2006Geometry Seminar: Algorithms on Grids16 Algorithm For each grid intersection point g 2 G –Compute smallest circle centered at p with k points –k-th order statistic of {||p, g||} –Expected time O(n) –Return the best of (n/k) 2 candidates Running time: O(n(n/k) 2 )
17
10/2/2006Geometry Seminar: Algorithms on Grids17 Correctness 2 -Opt: r(P,k) · 2r opt (P,k)
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.