0% found this document useful (0 votes)
4 views

Convex Hull

Uploaded by

wogodo3832
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Convex Hull

Uploaded by

wogodo3832
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Computational Geometry

CSE 9016

Instructor:
Dr. Sanjib Sadhu

Department of CSE
National Institute of Technology, Durgapur

February 9, 2021
Developping an algorithm

approach: incremental, from left to right


Let’s first compute the upper boundary of the convex hull this way
(property: on the upper hull, points appear in x-order)
Main idea: Sort the points from left to right (= by x-coordinate).
Then insert the points in this order, and maintain the upper hull so
far

Instructor: Dr. Sanjib Sadhu Computational Geometry


Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
Instructor: Dr. Sanjib Sadhu Computational Geometry
The pseudo code

Instructor: Dr. Sanjib Sadhu Computational Geometry


The pseudo code

Instructor: Dr. Sanjib Sadhu Computational Geometry


Algorithm analysis

Algorithm analysis generally has two components:


proof of correctness
efficiency analysis, proof of running time

Instructor: Dr. Sanjib Sadhu Computational Geometry


Correctness

Are the general observations on which the algorithm is based


correct?

Does the algorithm handle degenerate cases correctly? Here:

Does the sorted order matter if two or more points have the
same x-coordinate?
What happens if there are three or more collinear points, in
particular on the convex hull?

Instructor: Dr. Sanjib Sadhu Computational Geometry


Efficiency

Identify of each line of pseudo-code how much time it takes, if


it is executed once (note: operations on a constant number of
constant-size objects take constant time)
Consider the loop-structure and examine how often each line
of pseudo-code is executed
Sometimes there are global arguments why an algorithm is
more efficient than it seems, at first

Instructor: Dr. Sanjib Sadhu Computational Geometry


The pseudo code

Instructor: Dr. Sanjib Sadhu Computational Geometry


Efficiency

å The sorting step takes O(n log n) time.


å Adding a point takes O(1) time for the adding-part. Removing
points takes constant time for each removed point. If due to
an addition, k points are removed, the step takes O(1 + k)
time.
å Total time: O(nlogn) + Σni=1 O(1 + ki ) if ki points are
removed when adding pi
å Since ki = O(n), we get O(n log n) + Σni=3 O(n) = O(n2 )

Instructor: Dr. Sanjib Sadhu Computational Geometry


Efficiency

å Global argument: each point can be removed only once from


the upper hull.
å This gives us the fact: Σni=3 ki ≤ n
å Hence,
O(n log n) + Σni=3 O(1 + ki ) = O(n log n) + O(n) = O(n log n)

Instructor: Dr. Sanjib Sadhu Computational Geometry


Final Result

The convex hull of a set of n points in the plane can be computed


in O(n log n) time, and this is optimal.

Instructor: Dr. Sanjib Sadhu Computational Geometry

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy