Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chanโ€™s algorithm CS504 Presentation.

Similar presentations


Presentation on theme: "Chanโ€™s algorithm CS504 Presentation."โ€” Presentation transcript:

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


Download ppt "Chanโ€™s algorithm CS504 Presentation."

Similar presentations


Ads by Google