[英]Given a set of points S, and a point p determine whether there exist a half-plane L such that L contains p but does not contain any other point from S
Given a set of points S, and a point p, determine whether there exist a half-plane L such that L contains p, but does not contain any other point from S.给定一组点 S 和一个点 p,确定是否存在一个半平面 L,使得 L 包含 p,但不包含 S 中的任何其他点。
My solution:我的解决方案:
find the CH(S) - o(nlogn).找到 CH(S) - o(nlogn)。
check if p is inside CH(S) - o(n).检查 p 是否在 CH(S) - o(n) 内。
return true iff p is inside CH(S).如果 p 在 CH(S) 内,则返回 true。
Total time complexity - o(nlogn).总时间复杂度 - o(nlogn)。
Is there a more efficient algorithm?有没有更高效的算法?
Assuming from your proposed algorithm that we're considering a Euclidean space with three dimensions (or even a fixed number of dimensions), yes, there's a linear-time algorithm by formulating the problem as a linear program and solving it with Megiddo's algorithm.假设从您提出的算法中我们正在考虑具有三个维度(甚至是固定数量的维度)的欧几里得空间,是的,通过将问题表述为线性程序并使用 Megiddo 算法解决它,有一个线性时间算法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.