简体   繁体   English

二维峰值查找中最严格的下限是多少?

[英]What are the tighest lower bound in a 2-D Peak Finding?

I would like to know the lower bound for time complexity in algorithms that need to find just one peak in a 2D array, and in general in a ND array.我想知道算法中时间复杂度的下限,这些算法只需要在二维数组中找到一个峰值,通常是在 ND 数组中。 The best for 2-DI achieved was O(n) 2-DI 的最佳实现是 O(n)

For an N x M array, consider the following algorithm:对于 N x M 数组,请考虑以下算法:

We take the middle row, and in O(M) find the maximum element.我们取中间行,并在 O(M) 中找到最大元素。 If both of its (columnwise) neighbors are not larger, it is a peak.如果它的两个(按列)邻居都不大,那么它就是一个峰值。 Otherwise, if the above number is larger, one of the top half of the rows must contain a peak.否则,如果上述数字较大,则上半部分行之一必须包含一个峰值。 Similarly of course for the bottom half.当然,下半部分也是如此。

Thus, we can divide the search space in half with an O(M) step, leading to a total runtime of O(M log N).因此,我们可以使用 O(M) 步骤将搜索空间分成两半,从而导致总运行时间为 O(M log N)。 I do believe this is optimal, but have not proven it so.我确实相信这是最优的,但还没有证明这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM