Given a fixed set of points. We need to find convex hull of given set. We also need to find convex hull when a point is removed from the set.
Initial Set of Points: (-2, 8) (-1, 2) (0, 1) (1, 0) (-3, 0) (-1, -9) (2, -6) (3, 0) (5, 3) (2, 5) Initial convex hull:- (-2, 8) (-3, 0) (-1, -9) (2, -6) (5, 3) Point to remove from the set : (-2, 8) Final convex hull: (2, 5) (-3, 0) (-1, -9) (2, -6) (5, 3)
Prerequisite : Convex Hull (Simple Divide and Conquer Algorithm)
The algorithm for solving the above problem is very easy. We simply check whether the point to be removed is a part of the convex hull. If it is, then we have to remove that point from the initial set and then make the convex hull again (refer Convex hull (divide and conquer) ).
And if not then we already have the solution (the convex hull will not change).
convex hull: -3 0 -1 -9 2 -6 5 3 2 5
It is simple to see that the maximum time taken per query is the time taken to construct the convex hull which is O(n*logn). So, the overall complexity is O(q*n*logn), where q is the number of points to be deleted.
This article is contributed by Amritya Vagmi. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Dynamic Convex hull | Adding Points to an Existing Convex Hull
- Perimeter of Convex hull for a given set of points
- Convex Hull | Set 1 (Jarvis's Algorithm or Wrapping)
- Convex Hull | Set 2 (Graham Scan)
- Quickhull Algorithm for Convex Hull
- Convex Hull using Divide and Conquer Algorithm
- Convex Hull | Monotone chain algorithm
- Check if the given point lies inside given N points of a Convex Polygon
- Number of Integral Points between Two Points
- Count of obtuse angles in a circle with 'k' equidistant points between 2 given points
- Minimum number of points to be removed to get remaining points on one side of axis
- Find the point on X-axis from given N points having least Sum of Distances from all other points
- Ways to choose three points with distance between the most distant points <= L
- Tangents between two Convex Polygons
- Find number of diagonals in n sided convex polygon
- Check whether two convex regular polygon have same center or not
- Check if given polygon is a convex polygon or not
- Closest Pair of Points using Divide and Conquer algorithm
- Closest Pair of Points | O(nlogn) Implementation
- Find Simple Closed Path for a given set of points