I have made a program to implement the Gift Wrapping algorithm of finding convex hull. Is there any way to generate a point set that serves as the worst case for this algorithm?
How will I generate such case?
I have made a program to implement the Gift Wrapping algorithm of finding convex hull. Is there any way to generate a point set that serves as the worst case for this algorithm?
How will I generate such case?
Suppose you have a set of points - S. When on every iteration you subtract one point from S and add this point to a convex hull and you need to check every point what still left in S.
The run time depends on the size of the output, so Jarvis's march is an output-sensitive algorithm.
So, bigger output - more time needed. And this can be achieved on the set which is convex hull of itself.
Probably the simplest way to generate such convex hull of n points it to put all points on a circle.