O标记,O(∞)= O(1)? [英] O-notation, O(∞) = O(1)?
本文介绍了O标记,O(∞)= O(1)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一个快速的想法;有人可以说O(∞)实际上是O(1)吗?
So a quick thought; Could one argue that O(∞) is actually O(1)?
- 我的意思是,这不取决于输入的大小吗?
- 所以从某种角度来说,它是恒定的,即使它是无限的.
还是表达O(∞)的唯一正确"方法?
Or is the only 'correct' way to express it O(∞)?
推荐答案
Infinity is not a number, or at least not a real number, so the expression is malformed. The correct way to express this is to simply state that a program doesn't terminate. Note: program, not algorithm, as an algorithm is guaranteed to terminate.
((如果需要,您可以在超限定数上定义big-O表示法.不过,我不确定这是否有用).
(If you wanted, you might be able to define big-O notation on transfinite numbers. I'm not sure if that would be of any use, though.)
这篇关于O标记,O(∞)= O(1)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文