SlideShare a Scribd company logo
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
Ad

More Related Content

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
Ashish Khetan
 
36 greedy
36 greedy36 greedy
36 greedy
Ikram Khan
 
A greedy algorithms
A greedy algorithmsA greedy algorithms
A greedy algorithms
Amit Kumar Rathi
 
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 Algorithms
Krishnan 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 algorithms
zukun
 
Week6n7 Applications of Derivative.pptx
Week6n7 Applications of  Derivative.pptxWeek6n7 Applications of  Derivative.pptx
Week6n7 Applications of Derivative.pptx
kashiijaam008
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
Edhole.com
 
algorithm unit 1
algorithm unit 1algorithm unit 1
algorithm unit 1
Monika Choudhery
 
Gradient descent
Gradient descentGradient descent
Gradient descent
Prashant Mudgal
 
Various other factorizing algorithm.pptx
Various other factorizing algorithm.pptxVarious other factorizing algorithm.pptx
Various other factorizing algorithm.pptx
Geeta Arora
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithms
Dr. 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.pdf
Guru Nanak Technical Institutions
 
heuristic technique.pptx...............................
heuristic technique.pptx...............................heuristic technique.pptx...............................
heuristic technique.pptx...............................
gursharansinghmavi20
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou
vafopoulos
 
01 CS316_Introduction.pdf5959695559655565
01 CS316_Introduction.pdf595969555965556501 CS316_Introduction.pdf5959695559655565
01 CS316_Introduction.pdf5959695559655565
yahiaf3k
 
Algorithm in computer science
Algorithm in computer scienceAlgorithm in computer science
Algorithm in computer science
Riazul Islam
 
lecture1 .pdf introduction to algorithms
lecture1 .pdf introduction to algorithmslecture1 .pdf introduction to algorithms
lecture1 .pdf introduction to algorithms
kero01289992383
 
module1_Introductiontoalgorithms_2022.pdf
module1_Introductiontoalgorithms_2022.pdfmodule1_Introductiontoalgorithms_2022.pdf
module1_Introductiontoalgorithms_2022.pdf
Shiwani Gupta
 
Nelder Mead Search Algorithm
Nelder Mead Search AlgorithmNelder Mead Search Algorithm
Nelder Mead Search Algorithm
Ashish 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 Algorithms
Krishnan 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 algorithms
zukun
 
Week6n7 Applications of Derivative.pptx
Week6n7 Applications of  Derivative.pptxWeek6n7 Applications of  Derivative.pptx
Week6n7 Applications of Derivative.pptx
kashiijaam008
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
Edhole.com
 
Various other factorizing algorithm.pptx
Various other factorizing algorithm.pptxVarious other factorizing algorithm.pptx
Various other factorizing algorithm.pptx
Geeta Arora
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithms
Dr. Rupa Ch
 
heuristic technique.pptx...............................
heuristic technique.pptx...............................heuristic technique.pptx...............................
heuristic technique.pptx...............................
gursharansinghmavi20
 
2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou2010 3-24 cryptography stamatiou
2010 3-24 cryptography stamatiou
vafopoulos
 
01 CS316_Introduction.pdf5959695559655565
01 CS316_Introduction.pdf595969555965556501 CS316_Introduction.pdf5959695559655565
01 CS316_Introduction.pdf5959695559655565
yahiaf3k
 
Algorithm in computer science
Algorithm in computer scienceAlgorithm in computer science
Algorithm in computer science
Riazul Islam
 
lecture1 .pdf introduction to algorithms
lecture1 .pdf introduction to algorithmslecture1 .pdf introduction to algorithms
lecture1 .pdf introduction to algorithms
kero01289992383
 
module1_Introductiontoalgorithms_2022.pdf
module1_Introductiontoalgorithms_2022.pdfmodule1_Introductiontoalgorithms_2022.pdf
module1_Introductiontoalgorithms_2022.pdf
Shiwani Gupta
 

More from Amrinder Arora (20)

NP-Completeness - II
NP-Completeness - IINP-Completeness - II
NP-Completeness - II
Amrinder Arora
 
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First Search
Amrinder 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 Traversal
Amrinder 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 Mahana
Amrinder 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 Learning
Amrinder Arora
 
NP completeness
NP completenessNP completeness
NP completeness
Amrinder Arora
 
Algorithmic Puzzles
Algorithmic PuzzlesAlgorithmic Puzzles
Algorithmic Puzzles
Amrinder 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 Analysis
Amrinder Arora
 
Dynamic Programming - Part II
Dynamic Programming - Part IIDynamic Programming - Part II
Dynamic Programming - Part II
Amrinder Arora
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1
Amrinder Arora
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
Amrinder 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 Points
Amrinder Arora
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
Amrinder Arora
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data Structures
Amrinder Arora
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic Notation
Amrinder 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 Filters
Amrinder Arora
 
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First Search
Amrinder 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 Traversal
Amrinder 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 Mahana
Amrinder 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 Learning
Amrinder 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 Analysis
Amrinder Arora
 
Dynamic Programming - Part II
Dynamic Programming - Part IIDynamic Programming - Part II
Dynamic Programming - Part II
Amrinder Arora
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1
Amrinder 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 Points
Amrinder Arora
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
Amrinder Arora
 
Asymptotic Notation and Data Structures
Asymptotic Notation and Data StructuresAsymptotic Notation and Data Structures
Asymptotic Notation and Data Structures
Amrinder Arora
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic Notation
Amrinder 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 Filters
Amrinder Arora
 
Ad

Recently uploaded (20)

How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Contact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: OptometryContact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: Optometry
MushahidRaza8
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Engage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdfEngage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdf
TechSoup
 
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdfAPM Midlands Region April 2025 Sacha Hind Circulated.pdf
APM Midlands Region April 2025 Sacha Hind Circulated.pdf
Association for Project Management
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Contact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: OptometryContact Lens:::: An Overview.pptx.: Optometry
Contact Lens:::: An Overview.pptx.: Optometry
MushahidRaza8
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Engage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdfEngage Donors Through Powerful Storytelling.pdf
Engage Donors Through Powerful Storytelling.pdf
TechSoup
 
Grade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable WorksheetGrade 2 - Mathematics - Printable Worksheet
Grade 2 - Mathematics - Printable Worksheet
Sritoma Majumder
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
Ad

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