SlideShare a Scribd company logo
1 of 18
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

What's hot

PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...
PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...
PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...Jisang Yoon
 
Polynomial m2 2561
Polynomial m2 2561Polynomial m2 2561
Polynomial m2 2561Tum Anucha
 
สมการเชิงเส้นตัวแปรเดียว
สมการเชิงเส้นตัวแปรเดียวสมการเชิงเส้นตัวแปรเดียว
สมการเชิงเส้นตัวแปรเดียวPiyanouch Suwong
 
Coin Change Problem
Coin Change ProblemCoin Change Problem
Coin Change ProblemDEVTYPE
 
Faster R-CNN - PR012
Faster R-CNN - PR012Faster R-CNN - PR012
Faster R-CNN - PR012Jinwon Lee
 
名古屋CV・PRML勉強会 ShuffleNetの論文調査(説明追加)
名古屋CV・PRML勉強会 ShuffleNetの論文調査(説明追加)名古屋CV・PRML勉強会 ShuffleNetの論文調査(説明追加)
名古屋CV・PRML勉強会 ShuffleNetの論文調査(説明追加)Ryota Kondo
 
ABC Algorithm.
ABC Algorithm.ABC Algorithm.
ABC Algorithm.N Vinayak
 
Heuristic or informed search
Heuristic or informed searchHeuristic or informed search
Heuristic or informed searchHamzaJaved64
 
รากที่สอง
รากที่สองรากที่สอง
รากที่สองSuputtra Panam
 
SapporoR#6 初心者セッションスライド
SapporoR#6 初心者セッションスライドSapporoR#6 初心者セッションスライド
SapporoR#6 初心者セッションスライドHiroshi Shimizu
 
DQN (Deep Q-Network)
DQN (Deep Q-Network)DQN (Deep Q-Network)
DQN (Deep Q-Network)Dong Guo
 
EuroSciPy 2019 - GANs: Theory and Applications
EuroSciPy 2019 - GANs: Theory and ApplicationsEuroSciPy 2019 - GANs: Theory and Applications
EuroSciPy 2019 - GANs: Theory and ApplicationsEmanuele Ghelfi
 
Restricted Boltzmann Machine - A comprehensive study with a focus on Deep Bel...
Restricted Boltzmann Machine - A comprehensive study with a focus on Deep Bel...Restricted Boltzmann Machine - A comprehensive study with a focus on Deep Bel...
Restricted Boltzmann Machine - A comprehensive study with a focus on Deep Bel...Indraneel Pole
 

What's hot (20)

PMED: APPM Workshop: Overview of Methods for Subgroup Identification in Clini...
PMED: APPM Workshop: Overview of Methods for Subgroup Identification in Clini...PMED: APPM Workshop: Overview of Methods for Subgroup Identification in Clini...
PMED: APPM Workshop: Overview of Methods for Subgroup Identification in Clini...
 
Deep learning
Deep learningDeep learning
Deep learning
 
Hidden markov model
Hidden markov modelHidden markov model
Hidden markov model
 
PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...
PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...
PPT - Enhancing the Locality and Breaking the Memory Bottleneck of Transforme...
 
Convex hull
Convex hullConvex hull
Convex hull
 
Polynomial m2 2561
Polynomial m2 2561Polynomial m2 2561
Polynomial m2 2561
 
สมการเชิงเส้นตัวแปรเดียว
สมการเชิงเส้นตัวแปรเดียวสมการเชิงเส้นตัวแปรเดียว
สมการเชิงเส้นตัวแปรเดียว
 
DP
DPDP
DP
 
Coin Change Problem
Coin Change ProblemCoin Change Problem
Coin Change Problem
 
Faster R-CNN - PR012
Faster R-CNN - PR012Faster R-CNN - PR012
Faster R-CNN - PR012
 
名古屋CV・PRML勉強会 ShuffleNetの論文調査(説明追加)
名古屋CV・PRML勉強会 ShuffleNetの論文調査(説明追加)名古屋CV・PRML勉強会 ShuffleNetの論文調査(説明追加)
名古屋CV・PRML勉強会 ShuffleNetの論文調査(説明追加)
 
ABC Algorithm.
ABC Algorithm.ABC Algorithm.
ABC Algorithm.
 
แบบฝึกจำนวนและตัวเลข ป.2
แบบฝึกจำนวนและตัวเลข ป.2แบบฝึกจำนวนและตัวเลข ป.2
แบบฝึกจำนวนและตัวเลข ป.2
 
Pseudo Random Number
Pseudo Random NumberPseudo Random Number
Pseudo Random Number
 
Heuristic or informed search
Heuristic or informed searchHeuristic or informed search
Heuristic or informed search
 
รากที่สอง
รากที่สองรากที่สอง
รากที่สอง
 
SapporoR#6 初心者セッションスライド
SapporoR#6 初心者セッションスライドSapporoR#6 初心者セッションスライド
SapporoR#6 初心者セッションスライド
 
DQN (Deep Q-Network)
DQN (Deep Q-Network)DQN (Deep Q-Network)
DQN (Deep Q-Network)
 
EuroSciPy 2019 - GANs: Theory and Applications
EuroSciPy 2019 - GANs: Theory and ApplicationsEuroSciPy 2019 - GANs: Theory and Applications
EuroSciPy 2019 - GANs: Theory and Applications
 
Restricted Boltzmann Machine - A comprehensive study with a focus on Deep Bel...
Restricted Boltzmann Machine - A comprehensive study with a focus on Deep Bel...Restricted Boltzmann Machine - A comprehensive study with a focus on Deep Bel...
Restricted Boltzmann Machine - A comprehensive study with a focus on Deep Bel...
 

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

Nelder Mead Search Algorithm
Nelder Mead Search AlgorithmNelder Mead Search Algorithm
Nelder Mead Search AlgorithmAshish Khetan
 
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"22bcs058
 
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...2022cspaawan12556
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsKrishnan MuthuManickam
 
Skiena algorithm 2007 lecture01 introduction to algorithms
Skiena algorithm 2007 lecture01 introduction to algorithmsSkiena algorithm 2007 lecture01 introduction to algorithms
Skiena algorithm 2007 lecture01 introduction to algorithmszukun
 
Week6n7 Applications of Derivative.pptx
Week6n7 Applications of  Derivative.pptxWeek6n7 Applications of  Derivative.pptx
Week6n7 Applications of Derivative.pptxkashiijaam008
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in indiaEdhole.com
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithmsDr. Rupa Ch
 
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdfAI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdfAsst.prof M.Gokilavani
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiouvafopoulos
 
Algorithm in computer science
Algorithm in computer scienceAlgorithm in computer science
Algorithm in computer scienceRiazul Islam
 
module1_Introductiontoalgorithms_2022.pdf
module1_Introductiontoalgorithms_2022.pdfmodule1_Introductiontoalgorithms_2022.pdf
module1_Introductiontoalgorithms_2022.pdfShiwani Gupta
 
Basics of Mathematical Cryptography
Basics of Mathematical CryptographyBasics of Mathematical Cryptography
Basics of Mathematical CryptographyNeha Gupta
 
The Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxThe Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxHalimFerchichi
 

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

Nelder Mead Search Algorithm
Nelder Mead Search AlgorithmNelder Mead Search Algorithm
Nelder Mead Search Algorithm
 
36 greedy
36 greedy36 greedy
36 greedy
 
A greedy algorithms
A greedy algorithmsA greedy algorithms
A greedy algorithms
 
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
Mastering Greedy Algorithms: Optimizing Solutions for Efficiency"
 
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...DSA Complexity.pptx   What is Complexity Analysis? What is the need for Compl...
DSA Complexity.pptx What is Complexity Analysis? What is the need for Compl...
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
 
Skiena algorithm 2007 lecture01 introduction to algorithms
Skiena algorithm 2007 lecture01 introduction to algorithmsSkiena algorithm 2007 lecture01 introduction to algorithms
Skiena algorithm 2007 lecture01 introduction to algorithms
 
Week6n7 Applications of Derivative.pptx
Week6n7 Applications of  Derivative.pptxWeek6n7 Applications of  Derivative.pptx
Week6n7 Applications of Derivative.pptx
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
algorithm unit 1
algorithm unit 1algorithm unit 1
algorithm unit 1
 
Gradient descent
Gradient descentGradient descent
Gradient descent
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithms
 
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdfAI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou
 
Algorithm in computer science
Algorithm in computer scienceAlgorithm in computer science
Algorithm in computer science
 
module1_Introductiontoalgorithms_2022.pdf
module1_Introductiontoalgorithms_2022.pdfmodule1_Introductiontoalgorithms_2022.pdf
module1_Introductiontoalgorithms_2022.pdf
 
Basics of Mathematical Cryptography
Basics of Mathematical CryptographyBasics of Mathematical Cryptography
Basics of Mathematical Cryptography
 
The Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptxThe Traveling Salesman problem ppt.pptx
The Traveling Salesman problem ppt.pptx
 
L06
L06L06
L06
 
Anu DAA i1t unit
Anu DAA i1t unitAnu DAA i1t unit
Anu DAA i1t unit
 

More from Amrinder Arora

Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchAmrinder Arora
 
Graph Traversal Algorithms - Depth First Search Traversal
Graph Traversal Algorithms - Depth First Search TraversalGraph Traversal Algorithms - Depth First Search Traversal
Graph Traversal Algorithms - Depth First Search TraversalAmrinder Arora
 
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...
Bron Kerbosch Algorithm - Presentation by Jun Zhai, Tianhang Qiang and Yizhen...Amrinder Arora
 
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet MahanaArima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet Mahana
Arima Forecasting - Presentation by Sera Cresta, Nora Alosaimi and Puneet MahanaAmrinder Arora
 
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...
Stopping Rule for Secretory Problem - Presentation by Haoyang Tian, Wesam Als...Amrinder Arora
 
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...
Proof of O(log *n) time complexity of Union find (Presentation by Wei Li, Zeh...Amrinder Arora
 
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)
Proof of Cook Levin Theorem (Presentation by Xiechuan, Song and Shuo)Amrinder Arora
 
Online algorithms in Machine Learning
Online algorithms in Machine LearningOnline algorithms in Machine Learning
Online algorithms in Machine LearningAmrinder Arora
 
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisEuclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisAmrinder Arora
 
Dynamic Programming - Part II
Dynamic Programming - Part IIDynamic Programming - Part II
Dynamic Programming - Part IIAmrinder Arora
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1Amrinder Arora
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsAmrinder Arora
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1Amrinder Arora
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAmrinder Arora
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationAmrinder Arora
 
Set Operations - Union Find and Bloom Filters
Set Operations - Union Find and Bloom FiltersSet Operations - Union Find and Bloom Filters
Set Operations - Union Find and Bloom FiltersAmrinder Arora
 

More from Amrinder Arora (20)

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

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 

Recently uploaded (20)

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.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

  1. Two concepts