SlideShare a Scribd company logo
7
Most read
13
Most read
15
Most read
CONVEX HULL
Yitian Huang & Zhe Yang
Apr 22, 2016
1
Definition Of Convex HULL
Simply, given a set of points P in a plane, the convex hull of this set is the smallest convex polygon that
contains all points of it.
(A set of points and its convex hull)
2
We will introduce an O(nlogh) algorithm known as Chan’s
Algorithm, where h refers the number of points in the hull.
However, Chan’s Algorithm is based on other two
algorithms known as Jarvis’s Algorithm O(nh) and Graham’s
Algorithm O(nlogn).
So, we will talk about these two algorithms first.
3
Before Start…
• Counterclockwise and Clockwise
• It’s relative
• In this presentation
• Use function orient(p, q, i) to calculate the
relationship of pq and pi.
• Obviously, orient(p, q, i) = - orient(p, i, q)
• Extreme points
• There will be four extreme points
• All of them MUST be in the hull lastly
• Most algorithm choose to start with one of the
extreme points.
• In this presentation
• All algorithms will start will the left most point.
4
Jarvis’s Algorithm
5
Jarvis’s Algorithm
• Perhaps the simplest algorithm for computing Convex Hull
• In the two-dimensional case the algorithm is also known as Jarvis march, after R. A. Jarvis, who
published it in 1973.
• It has a more visual name: ‘Gift Wrapping’.
6
HOW IT WORKS?
1. Start with the left most point, l.
2. Let p = l, find out the point q that
appears to be furthest to the
right to someone standing at p
and looking at other points. (by
comparing all others points)
That’s is: orient(p, q, i) < 0 is always
true for all other points.
3. Set q as p, and use p as the start
point and use the same method
to find the next q.
4. Keep doing step 3, until q is equal
to l.
O(n)
O(h)
Total: O(nh)
O(n)
7
GRAHAM’S ALGORITHM
8
GRAHAM’S ALGORITHM
• It is named after Ronald Graham, who published the original algorithm in 1972.
• Also know as Graham’s scan, first explicitly sorts the points and then scanning algorithm to finish
building the hull.
• Basically, sort + scan.
9
HOW IT WORKS?
1. Start with the left most point, l.
2. Sorts all other points in
counterclockwise order around l.
That’s is: orient(l, i, i+1) > 0 is always
true for all points i.
3. Start with l, let p = l, q = l +1, i = l +
2.
4. Check orient(p, q, i)
• If < 0, move forward, let p = q, q =i, i =
i +1;
• If > 0, remove q, let p = p-1, q = p ;
5. Keep doing step 4, until all points
have been checked.
O(nlogn)
O(n)
Total: O(nlogn)
O(n)
SORTSCAN
10
CHAN’S ALGORITHM
11
Chan’s Algorithm = Jarvis's + Graham’s + ...
• It was discovered by Timothy Chan in 1993.
• It’s a combination of divide-and-conquer, gift-wrapping and graham’s scan.
• it’s output-sensitive, which means its running time depends on the size of its output (or input).
12
HOW IT WORKS?
1. Find a magic value of ‘m’, which
divides all points into n/m subsets,
and each subset has m points,
approximately.
2. To each subset, use Graham’s
algorithm to compute its sub-hull.
3. To all sub-hulls, use Jarvis’s
algorithm to compute the final
convex hull.
• Choose one extreme point as the start
point, and compare the right tangents
of all sub-hulls.
• Choose the rightest one as the next
point.
• Start with the next point, and do it
again, until the next point is equal to
the start point
13
Find Magic ‘m’
• The core of Chan’s algorithm is how to figure out the value of m. (The object is to make m very close to
h, or equal)
• Chan proposed a amazing trick here:
• We set a parameter t = 1 and set m = 2^(2^t).
• Then use this m to execute Chan’s Algorithm, in step 3, we set a counter for the output number of points in the
hull. Once the counter reaches value m, it terminate the algorithm and increment t by 1, re-calculate the value
m, and do it again!
• By doing this, the time for running this algorithm will always be less than O(nlogm).
14
TIME COMPLEXITY
• We divided points into n/m parts, so each part has m
points.
• Since the algorithm will be terminated when it number
of output reaches m, so this step will at most cost
O(nlogm), when m is small.
• For step 2
• It’s O((n/m) * mlogm) = O(nlogm)
• For step 3
• Finding one extreme point, O(n).
• tangents
• Finding the right tangents of one sub-hull, O(logm).
• There are n/m sub-hulls, so O((n/m)logm)
• There are h points in the hull. O(h*(n/m)logm) = O(nlogh)
when h=m.
• Totally, it’s O(nlogh).
1. Find a magic value of ‘m’, which
divides all points into n/m subsets,
and each subset has m points,
approximately.
2. To each subset, use Graham’s
algorithm to compute its sub-hull.
3. To all sub-hulls, use Jarvis’s
algorithm to compute the final
convex hull.
• Choose one extreme point as the start
point, and compare the right tangents
of all sub-hulls.
• Choose the rightest one as the next
point.
• Start with the next point, and do it
again,until the next point is equal to
the start point
15
16
REFERENCES
• [1]. https://en.wikipedia.org/wiki/Chan%27s_algorithm
• [2]. http://tomswitzer.net/2010/12/2d-convex-hulls-chans-algorithm/
• [3]. http://jeffe.cs.illinois.edu/teaching/373/notes/x05-convexhull.pdf
• [4]. http://www.utdallas.edu/~daescu/convexhull.pdf
• [5]. http://www.geeksforgeeks.org/convex-hull-set-1-jarviss-algorithm-or-wrapping/
• [6]. http://www.geeksforgeeks.org/convex-hull-set-2-graham-scan/
17
THANK YOU!
QUESTIONS?
An example for Gift-wrapping
NOT Chan’s Algorithm!
18

More Related Content

PPTX
convex hull
PDF
Convex hull
PDF
Deeplabv1, v2, v3, v3+
PPTX
convex hull
PDF
Convex hulls & Chan's algorithm
PPTX
HITS + Pagerank
PPT
Unit IV UNCERTAINITY AND STATISTICAL REASONING in AI K.Sundar,AP/CSE,VEC
DOCX
0-1 KNAPSACK PROBLEM
 
convex hull
Convex hull
Deeplabv1, v2, v3, v3+
convex hull
Convex hulls & Chan's algorithm
HITS + Pagerank
Unit IV UNCERTAINITY AND STATISTICAL REASONING in AI K.Sundar,AP/CSE,VEC
0-1 KNAPSACK PROBLEM
 

What's hot (20)

PPTX
Knapsack problem using greedy approach
PPTX
Randomized algorithm min cut problem and its solution using karger's algorithm
PPTX
Curse of dimensionality
PPT
Greedy algorithms
PPTX
CLIQUE Automatic subspace clustering of high dimensional data for data mining...
PPTX
Principal Component Analysis (PCA) and LDA PPT Slides
PDF
Approximation Algorithms
PDF
Representation Learning of Text for NLP
PPT
K means Clustering Algorithm
PPT
3.4 density and grid methods
PPT
Topic Models
PDF
AD3251-Data Structures Design-Notes-Searching-Hashing.pdf
PPT
Heap Sort || Heapify Method || Build Max Heap Algorithm
PPT
5.1 greedy
PPTX
04 Multi-layer Feedforward Networks
PPTX
Word embedding
PPTX
AI Propositional logic
PPTX
Instance based learning
PDF
08 Hash Tables
PPTX
Convex Hull Algorithms
Knapsack problem using greedy approach
Randomized algorithm min cut problem and its solution using karger's algorithm
Curse of dimensionality
Greedy algorithms
CLIQUE Automatic subspace clustering of high dimensional data for data mining...
Principal Component Analysis (PCA) and LDA PPT Slides
Approximation Algorithms
Representation Learning of Text for NLP
K means Clustering Algorithm
3.4 density and grid methods
Topic Models
AD3251-Data Structures Design-Notes-Searching-Hashing.pdf
Heap Sort || Heapify Method || Build Max Heap Algorithm
5.1 greedy
04 Multi-layer Feedforward Networks
Word embedding
AI Propositional logic
Instance based learning
08 Hash Tables
Convex Hull Algorithms
Ad

Similar to Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and Zhe Yang (20)

PPTX
Nelder Mead Search Algorithm
PPT
36 greedy
PDF
A greedy algorithms
PDF
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
PPTX
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
PPT
CS8451 - Design and Analysis of Algorithms
PDF
Skiena algorithm 2007 lecture01 introduction to algorithms
PPTX
Week6n7 Applications of Derivative.pptx
PPT
Mba admission in india
RTF
algorithm unit 1
PDF
Gradient descent
PPTX
Various other factorizing algorithm.pptx
RTF
Design and Analysis of algorithms
PDF
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
PPTX
heuristic technique.pptx...............................
PPT
2010 3-24 cryptography stamatiou
PDF
01 CS316_Introduction.pdf5959695559655565
PPTX
Algorithm in computer science
PDF
lecture1 .pdf introduction to algorithms
PDF
module1_Introductiontoalgorithms_2022.pdf
Nelder Mead Search Algorithm
36 greedy
A greedy algorithms
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
CS8451 - Design and Analysis of Algorithms
Skiena algorithm 2007 lecture01 introduction to algorithms
Week6n7 Applications of Derivative.pptx
Mba admission in india
algorithm unit 1
Gradient descent
Various other factorizing algorithm.pptx
Design and Analysis of algorithms
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
heuristic technique.pptx...............................
2010 3-24 cryptography stamatiou
01 CS316_Introduction.pdf5959695559655565
Algorithm in computer science
lecture1 .pdf introduction to algorithms
module1_Introductiontoalgorithms_2022.pdf
Ad

More from Amrinder Arora (20)

PPTX
NP-Completeness - II
PPTX
Graph Traversal Algorithms - Breadth First Search
PPTX
Graph Traversal Algorithms - Depth First Search Traversal
PDF
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
PDF
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
PDF
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
PDF
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
PDF
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
PPTX
Online algorithms in Machine Learning
PPTX
NP completeness
PPTX
Algorithmic Puzzles
PPTX
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
PPTX
Dynamic Programming - Part II
PPTX
Dynamic Programming - Part 1
PPTX
Greedy Algorithms
PPTX
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
PPTX
Divide and Conquer - Part 1
PPTX
Asymptotic Notation and Data Structures
PPTX
Introduction to Algorithms and Asymptotic Notation
PPTX
Set Operations - Union Find and Bloom Filters
NP-Completeness - II
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Depth First Search Traversal
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Online algorithms in Machine Learning
NP completeness
Algorithmic Puzzles
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Dynamic Programming - Part II
Dynamic Programming - Part 1
Greedy Algorithms
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part 1
Asymptotic Notation and Data Structures
Introduction to Algorithms and Asymptotic Notation
Set Operations - Union Find and Bloom Filters

Recently uploaded (20)

PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
RMMM.pdf make it easy to upload and study
PDF
01-Introduction-to-Information-Management.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Microbial diseases, their pathogenesis and prophylaxis
O5-L3 Freight Transport Ops (International) V1.pdf
Anesthesia in Laparoscopic Surgery in India
STATICS OF THE RIGID BODIES Hibbelers.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Complications of Minimal Access Surgery at WLH
A systematic review of self-coping strategies used by university students to ...
Pharma ospi slides which help in ospi learning
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Chinmaya Tiranga quiz Grand Finale.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Cell Structure & Organelles in detailed.
Abdominal Access Techniques with Prof. Dr. R K Mishra
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Module 4: Burden of Disease Tutorial Slides S2 2025
Supply Chain Operations Speaking Notes -ICLT Program
RMMM.pdf make it easy to upload and study
01-Introduction-to-Information-Management.pdf

Convex Hull - Chan's Algorithm O(n log h) - Presentation by Yitian Huang and Zhe Yang

  • 1. CONVEX HULL Yitian Huang & Zhe Yang Apr 22, 2016 1
  • 2. Definition Of Convex HULL Simply, given a set of points P in a plane, the convex hull of this set is the smallest convex polygon that contains all points of it. (A set of points and its convex hull) 2
  • 3. We will introduce an O(nlogh) algorithm known as Chan’s Algorithm, where h refers the number of points in the hull. However, Chan’s Algorithm is based on other two algorithms known as Jarvis’s Algorithm O(nh) and Graham’s Algorithm O(nlogn). So, we will talk about these two algorithms first. 3
  • 4. Before Start… • Counterclockwise and Clockwise • It’s relative • In this presentation • Use function orient(p, q, i) to calculate the relationship of pq and pi. • Obviously, orient(p, q, i) = - orient(p, i, q) • Extreme points • There will be four extreme points • All of them MUST be in the hull lastly • Most algorithm choose to start with one of the extreme points. • In this presentation • All algorithms will start will the left most point. 4
  • 6. Jarvis’s Algorithm • Perhaps the simplest algorithm for computing Convex Hull • In the two-dimensional case the algorithm is also known as Jarvis march, after R. A. Jarvis, who published it in 1973. • It has a more visual name: ‘Gift Wrapping’. 6
  • 7. HOW IT WORKS? 1. Start with the left most point, l. 2. Let p = l, find out the point q that appears to be furthest to the right to someone standing at p and looking at other points. (by comparing all others points) That’s is: orient(p, q, i) < 0 is always true for all other points. 3. Set q as p, and use p as the start point and use the same method to find the next q. 4. Keep doing step 3, until q is equal to l. O(n) O(h) Total: O(nh) O(n) 7
  • 9. GRAHAM’S ALGORITHM • It is named after Ronald Graham, who published the original algorithm in 1972. • Also know as Graham’s scan, first explicitly sorts the points and then scanning algorithm to finish building the hull. • Basically, sort + scan. 9
  • 10. HOW IT WORKS? 1. Start with the left most point, l. 2. Sorts all other points in counterclockwise order around l. That’s is: orient(l, i, i+1) > 0 is always true for all points i. 3. Start with l, let p = l, q = l +1, i = l + 2. 4. Check orient(p, q, i) • If < 0, move forward, let p = q, q =i, i = i +1; • If > 0, remove q, let p = p-1, q = p ; 5. Keep doing step 4, until all points have been checked. O(nlogn) O(n) Total: O(nlogn) O(n) SORTSCAN 10
  • 12. Chan’s Algorithm = Jarvis's + Graham’s + ... • It was discovered by Timothy Chan in 1993. • It’s a combination of divide-and-conquer, gift-wrapping and graham’s scan. • it’s output-sensitive, which means its running time depends on the size of its output (or input). 12
  • 13. HOW IT WORKS? 1. Find a magic value of ‘m’, which divides all points into n/m subsets, and each subset has m points, approximately. 2. To each subset, use Graham’s algorithm to compute its sub-hull. 3. To all sub-hulls, use Jarvis’s algorithm to compute the final convex hull. • Choose one extreme point as the start point, and compare the right tangents of all sub-hulls. • Choose the rightest one as the next point. • Start with the next point, and do it again, until the next point is equal to the start point 13
  • 14. Find Magic ‘m’ • The core of Chan’s algorithm is how to figure out the value of m. (The object is to make m very close to h, or equal) • Chan proposed a amazing trick here: • We set a parameter t = 1 and set m = 2^(2^t). • Then use this m to execute Chan’s Algorithm, in step 3, we set a counter for the output number of points in the hull. Once the counter reaches value m, it terminate the algorithm and increment t by 1, re-calculate the value m, and do it again! • By doing this, the time for running this algorithm will always be less than O(nlogm). 14
  • 15. TIME COMPLEXITY • We divided points into n/m parts, so each part has m points. • Since the algorithm will be terminated when it number of output reaches m, so this step will at most cost O(nlogm), when m is small. • For step 2 • It’s O((n/m) * mlogm) = O(nlogm) • For step 3 • Finding one extreme point, O(n). • tangents • Finding the right tangents of one sub-hull, O(logm). • There are n/m sub-hulls, so O((n/m)logm) • There are h points in the hull. O(h*(n/m)logm) = O(nlogh) when h=m. • Totally, it’s O(nlogh). 1. Find a magic value of ‘m’, which divides all points into n/m subsets, and each subset has m points, approximately. 2. To each subset, use Graham’s algorithm to compute its sub-hull. 3. To all sub-hulls, use Jarvis’s algorithm to compute the final convex hull. • Choose one extreme point as the start point, and compare the right tangents of all sub-hulls. • Choose the rightest one as the next point. • Start with the next point, and do it again,until the next point is equal to the start point 15
  • 16. 16
  • 17. REFERENCES • [1]. https://en.wikipedia.org/wiki/Chan%27s_algorithm • [2]. http://tomswitzer.net/2010/12/2d-convex-hulls-chans-algorithm/ • [3]. http://jeffe.cs.illinois.edu/teaching/373/notes/x05-convexhull.pdf • [4]. http://www.utdallas.edu/~daescu/convexhull.pdf • [5]. http://www.geeksforgeeks.org/convex-hull-set-1-jarviss-algorithm-or-wrapping/ • [6]. http://www.geeksforgeeks.org/convex-hull-set-2-graham-scan/ 17
  • 18. THANK YOU! QUESTIONS? An example for Gift-wrapping NOT Chan’s Algorithm! 18

Editor's Notes

  • #5: Two concepts