Download presentation
Presentation is loading. Please wait.
1
Chan’s algorithm CS504 Presentation
2
Graham’s Scan : 𝑂(𝑛 log 𝑛 ) Jarvis’s March : 𝑂(𝑛ℎ)
Planar Convex Hull Graham’s Scan : 𝑂(𝑛 log 𝑛 ) Jarvis’s March : 𝑂(𝑛ℎ) Is there any 𝑂(𝑛 log ℎ ) algorithm? CS504 Presentation
3
3 stages of Chan’s algorithm
combining Graham’s scan and Jarvis’s March together 𝑂 𝑛 log ℎ 3 stages of Chan’s algorithm 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
4
Consider arbitrary value 𝑚<𝑛, the size of partition
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
5
Chan’s Algorithm Stage 1 n = 32 Set m = 8 CS504 Presentation
6
Chan’s Algorithm Stage 1 n = 32 Set m = 8 r = 4 CS504 Presentation
7
Compute convex hull of each partition using Graham’s scan
Chan’s Algorithm Stage2 : Graham’s Scan Compute convex hull of each partition using Graham’s scan Total 𝑂(𝑛 log 𝑚 ) time CS504 Presentation
8
Chan’s Algorithm Stage 2 (After Stage 1) m = 8 r = 4
CS504 Presentation
9
Chan’s Algorithm Stage 2 Using Graham’s Scan O 𝑚 log 𝑚 for each group
-> total 𝑂(𝑚𝑟 log 𝑚 ) = 𝑂(𝑛 log 𝑚 ) CS504 Presentation
10
How to merge these r hulls into a single hull?
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
11
Chan’s Algorithm (-inf,0) -> lowest pt (−∞,0) lowest pt
CS504 Presentation
12
Find the point that maximize the angle in each hull
Chan’s Algorithm Find the point that maximize the angle in each hull (−∞,0) 1 lowest pt CS504 Presentation
13
Find the point that maximize the angle in each hull
Chan’s Algorithm Find the point that maximize the angle in each hull (−∞,0) 2 1 lowest pt CS504 Presentation
14
Find the point that maximize the angle in each hull
Chan’s Algorithm Find the point that maximize the angle in each hull 3 (−∞,0) 2 1 lowest pt CS504 Presentation
15
Chan’s Algorithm If 𝑚<ℎ, then the algorithm will fail!
CS504 Presentation
16
FAIL EXAMPLE – too small value m
Chan’s Algorithm FAIL EXAMPLE – too small value m m = 4 (−∞,0) 4 iteration CS504 Presentation
17
Chan’s Algorithm In 4(a), how to find such points? CS504 Presentation
18
Find the point that maximize the angle in each hull
Chan’s Algorithm Find the point that maximize the angle in each hull (−∞,0) 1 lowest pt CS504 Presentation
19
Find the point that maximize the angle in a hull
Chan’s Algorithm Find the point that maximize the angle in a hull (−∞,0) CS504 Presentation
20
Finding tangent between a point and a convex 𝑚-gon
Chan’s Algorithm Finding tangent between a point and a convex 𝑚-gon 5 1 𝑂 log 𝑚 process 4 3 2 CS504 Presentation
21
Chan’s Algorithm → 𝑂( log 𝑚 ) CS504 Presentation
22
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
23
The only question remaining is…
Chan’s Algorithm The only question remaining is… how do we know what value to give to 𝑚? CS504 Presentation
24
Then we eventually get 𝑚 to be in [ℎ, ℎ 2 ] !
Chan’s Algorithm Answer : square search Try this way - 𝑚=2, 4, 8, …, 𝑡 , … Then we eventually get 𝑚 to be in [ℎ, ℎ 2 ] ! CS504 Presentation
25
The algorithm stops as soon as 2 2 𝑡 ≥ℎ
Chan’s Algorithm The algorithm stops as soon as 𝑡 ≥ℎ 𝑡= lg lg ℎ Total time complexity 𝑡=1 lg lg ℎ 𝑛 log 𝑡 = 𝑡=1 lg lg ℎ 𝑛 2 𝑡 ≤𝑛 lg lg ℎ =2𝑛 2 lg lg ℎ =2𝑛 log ℎ =𝑂(𝑛 log ℎ ) CS504 Presentation
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.