非单调时间复杂度算法
作为一个思维练习,我试图想出一种具有非单调复杂度曲线的算法。我唯一能想到的是一些在四肢具有渐近解的算法。
是否存在这样的算法,其具有非单调复杂度曲线,不依赖渐近逼近?
As a thought exercise, I am trying to think of an algorithm which has a non-monotonic complexity curve. The only thing I could think of was some algorithm with asymptotic solution in extremities.
Is there such algorithm, which has non-monotonic complexity curve, which does not rely on asymptotic approximation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想到了离散傅里叶变换;如果按如下方式应用,它将是非单调的(并且不连续):
因为 dft 运行在 O(N**2) 中,而 fft 运行在 O(N log N) 中。
设计一种算法时,人们可能会找到一种方法来填充输入数据以消除非单调行为(即加速较小的输入),就像 fft 通常所做的那样。
The discrete Fourier transform comes to mind; if it was applied as follows it would be non-monotonic (and discontinuous):
since dft runs in O(N**2) and fft runs in O(N log N).
Designing an algorithm, one would probably find a way to pad the input data to remove non-monotonic behavior (i.e. accelerate smaller inputs), as is commonly done with fft.
我不知道你所说的“渐近逼近”是什么意思,但从理论上讲,构建这样的“算法”很容易......
I don't know what you mean by 'asymptotic approximation', but theoretically, it is easy to construct such 'algorithm'...
我不认为有很多(任何?)像这样的真实算法,但就在我的脑海中,在伪代码中:
这个算法不是渐近的,因为 n 趋于无穷大。
I don't think that there are many (any?) real algorithms like this, but just off the top of my head, in pseudo code:
This algorithm isn't asymptotic as n goes to infinity.