Chan`sAlgorithm
Download
Report
Transcript Chan`sAlgorithm
Chanβs algorithm
CS504 Presentation
Planar Convex Hull
β’ Grahamβs Scan : π(π log π)
β’ Jarvisβs March : π(πβ)
β’ Is there any π(π log β) algorithm?
CS504 Presentation
Chanβs Algorithm
β’ Chanβs algorithm
β combining Grahamβs scan and Jarvisβs March together
β π π log β
β’ 3 stages of Chanβs algorithm
1.
2.
3.
divide vertices into partitions
apply Grahamβs scan on each partition
apply Jarvisβs March on the small convex hull
(repeat 1~3 until we find the hull)
CS504 Presentation
Chanβs Algorithm
β’ Stage1 : Partition
β’ Consider arbitrary value π < π, the size of partition
β how to decide π will be treated later
β’ Partition the points into groups, each of size π
β π=
π
π
is the number of groups
CS504 Presentation
Chanβs Algorithm
β’ Stage 1
n = 32
Set m = 8
CS504 Presentation
Chanβs Algorithm
β’ Stage 1
n = 32
Set m = 8
r=4
CS504 Presentation
Chanβs Algorithm
β’ Stage2 : Grahamβs Scan
β’ Compute convex hull of each partition using Grahamβs
scan
β’ Total π(π log π) time
CS504 Presentation
Chanβs Algorithm
β’ Stage 2
(After Stage 1)
m=8
r=4
CS504 Presentation
Chanβs Algorithm
β’ Stage 2
Using Grahamβs Scan
O π log π for each group
-> total π(ππ log π)
= π(π log π)
CS504 Presentation
Chanβs Algorithm
β’ Stage3 : Jarvisβs March
β’ How to merge these r hulls into a single hull?
β’ IDEA : treat each hull as a βfat pointβ and run Jarvisβs
March!
β’ # of iteration is at most m
β to guarantee the time complexity O(nlogh)
CS504 Presentation
Chanβs Algorithm
β’ (-inf,0) -> lowest pt
(ββ, 0)
lowest pt
CS504 Presentation
Chanβs Algorithm
β’ Find the point that maximize the angle in each hull
(ββ, 0)
1
lowest pt
CS504 Presentation
Chanβs Algorithm
β’ Find the point that maximize the angle in each hull
(ββ, 0)
2
1
lowest pt
CS504 Presentation
Chanβs Algorithm
β’ Find the point that maximize the angle in each hull
3
(ββ, 0)
2
1
lowest pt
CS504 Presentation
Chanβs Algorithm
If π < β, then the algorithm will fail!
CS504 Presentation
Chanβs Algorithm
β’ FAIL EXAMPLE β too small value m
m=4
(ββ, 0)
4 iteration
CS504 Presentation
Chanβs Algorithm
In 4(a), how to find such points?
CS504 Presentation
Chanβs Algorithm
β’ Find the point that maximize the angle in each hull
(ββ, 0)
1
lowest pt
CS504 Presentation
Chanβs Algorithm
β’ Find the point that maximize the angle in a hull
(ββ, 0)
CS504 Presentation
Chanβs Algorithm
β’ Finding tangent between a point and a convex π-gon
5
1
π log π process
4
3
2
CS504 Presentation
Chanβs Algorithm
β π(log π)
CS504 Presentation
Chanβs Algorithm
Analysis
β’ Suppose God told you some good value for π
β β β€ π β€ β2
β’ π π log π for stage1~2
β’ At most h steps in Jarvisβs March
β π(log π) time to compute each tangent
β π tangent for each iteration
π
β total π βπ log π = π(β π log π) time
β’ π
π+β
π
π
log π = π π log π = π(π log β) as desired.
π β€ β2
CS504 Presentation
Chanβs Algorithm
β’ The only question remaining isβ¦
how do we know what value to give to π?
CS504 Presentation
Chanβs Algorithm
β’ Answer : square search
β’ Try this way - π =
π‘
2
2, 4, 8, β¦ , 2 , β¦
β’ Then we eventually get π to be in [β, β2 ] !
CS504 Presentation
Chanβs Algorithm
β’ The algorithm stops as soon as
π‘
2
2
β₯β
β π‘ = lg lg β
β’ Total time complexity
lg lg β
lg lg β
π log 2
π‘=1
2π‘
π2π‘ β€ π 21+lg lg β = 2π 2lg lg β
=
π‘=1
= 2π log β = π(π log β)
CS504 Presentation