Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quick Hull Worst case explanation

What is the worst case for quick hull?? And how we can know that it is the worst case I am confused with quick hull algorithm. Actually, I understood, that running determinant to find the area of a triangle, and if the area is positive, then the point is on the left of the extreme points. And doing this thing recursively, will have O(n) efficiency for constructing a hull. Then I don't understood, that how to efficiency is sometimes mentioned O(nlogn) and )(n^2)? for which cases this efficiency turns out and how? please if someone can help by some particular example; that would be great help.

like image 287
robot Avatar asked Nov 11 '12 07:11

robot


People also ask

Is quick hull divide and conquer?

Convex Hull | Set 1 (Jarvis's Algorithm or Wrapping) Convex Hull | Set 2 (Graham Scan) The QuickHull algorithm is a Divide and Conquer algorithm similar to QuickSort. Let a[0…n-1] be the input array of points.

What is the other name of quick hull?

What is the other name for quick hull problem? Explanation: The other name for quick hull problem is convex hull problem whereas the closest pair problem is the problem of finding the closest distance between two points.

What is convex hull problem?

Computing the convex hull is a problem in computational geometry. The indices of the points specifying the convex hull of a set of points in two dimensions is given by the command ConvexHull[pts] in the Wolfram Language package ComputationalGeometry` .

What is the use of convex hull?

Convex hulls have wide applications in mathematics, statistics, combinatorial optimization, economics, geometric modeling, and ethology. Related structures include the orthogonal convex hull, convex layers, Delaunay triangulation and Voronoi diagram, and convex skull.


2 Answers

I'm afraid the accepted answer is not correct.

In fact, the case above is the O(n log n) case. Just look at the recursion tree. In each step you cut the set of points in two approximately equally large subsets. Therefore the height of the recursion tree is O(log n), resulting in an overall runtime of O(n log n).

To be more precise: The recurrence relation of the quickhull algorithm is T(n) = T(a * n) + T(b * n) + c*n. The last term (c*n) represents the search for the pivot element. In the case constructed above, the constants a and b are a = b = 1/2. You can use the master theorem to determine the bound of O(n log n).

The worst case O(n2) is a*n ≈ n-1 and b*n ≈ 1. You can construct it by placing points on the border of a circle using the following rule (in polar coordinates): Pi = (r, π / 2i). With this set of points the pivot element will always be the left-most point and therefore the set is divided into a subset containing n-1 points and an empty subset. So in each step of the recursion you only "eliminate" one point (the pivot element). The height of the recursion tree is therefore O(n) resulting in an overall efficiency of O(n2).

like image 196
John Avatar answered Oct 13 '22 12:10

John


Here's an animated demo of John's answer, demonstrating how at each step, only one point is removed from consideration:

demo of

like image 44
rob mayoff Avatar answered Oct 13 '22 10:10

rob mayoff