2

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?

John Dvorak
  • 26,799
  • 13
  • 69
  • 83
user5411115
  • 101
  • 1
  • 9
  • 1
    If I am right, the worst case is when H=N, i.e. the test set is formed by the vertices of a convex polygon. –  Sep 30 '16 at 21:46

1 Answers1

2

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.

enter image description here

Yola
  • 18,496
  • 11
  • 65
  • 106