当 f(n) = n^.1 且 g(n) = log(n)^10 时,f(n) = Ω(g) 吗?
有人告诉我“任何指数都胜过任何对数”。
但是当指数在0到1之间时,对数的执行时间不是增长得快很多吗?因此,按照这种逻辑,f = O(g)
我很难选择是遵循我的直觉还是遵循我被告知的内容,但我被告知的内容可能并不完全准确。
I was told that "any exponential trumps any logarithm".
But when the exponential is between zero and one, doesn't the execution time of the logarithm grow much faster? So by that logic it would be f = O(g)
I'm having trouble choosing whether to follow my intuition or what I've been told, but what I've been told may have been not totally accurate.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
让我们在这里尝试一些数学。一个重要的事实是对数函数是单调递增的,这意味着如果
那么
现在,让我们看看它在这里做什么。我们有两个函数,x0.1 和 log10 x。如果我们获取他们的日志,我们会得到
并且
由于 log log x 的增长速度比 log x 慢得多,直观上我们可以看到函数 x0.1 最终会超过 log10 x。
现在,让我们将其形式化。我们想要找到 x 的某个值,使得
为了使数学更容易,我们假设这些是以 10 为底的对数。如果我们假设对于某些 k,x = 10k,我们会得到
现在,取 k = 100。现在我们有
这显然是正确的。由于两个函数都是单调递增的,这意味着对于 x ≥ 10100,确实有
这意味着 x0.1 = O(log10 k) 不成立。
希望这有帮助!
Let's try out some math here. One important fact is that the logarithm function is monotonically increasing, which means that if
then
Now, let's see what that does here. We have two functions, x0.1 and log10 x. If we take their logs, we get
and
Since log log x grows much more slowly than log x, intuitively we can see that the function x0.1 is going to eventually overtake log10 x.
Now, let's formalize this. We want to find some value of x such that
Let's suppose that these are base-10 logarithms just to make the math easier. If we assume that x = 10k for some k, we get that
Now, take k = 100. Now we have that
which is clearly true. Since both functions are monotonically increasing, this means that for x ≥ 10100, it is true that
Which means that it is not true that x0.1 = O(log10 k).
Hope this helps!
渐近分析真正关注的是长期关系(由于 n 假设较大的值,函数的值如何比较)?它还忽略常量,这就是为什么您有时会看到奇怪的情况,例如 f(x) = 10000000*x = O(x^2)。
对于较大的
n
值,f(n) > g(n)
这才是真正重要的。The asymptotic analysis is really focused on the long run relationship (as n assumes larger values, how do the values of the functions compare)? It also disregards constants, which is why you sometimes see strange situations like f(x) = 10000000*x = O(x^2).
For large values of
n
,f(n) > g(n)
which is all that really matters.使用限制规则验证
n^0.1 = big omega(log^10(n))
的另一种方法?限制规则为:
对于此问题:
这给了我们极限:
使用 L'Hospital 的极限规则 10 次,我们得到:
由于 n 项仅在分子中,因此极限接近无穷大。
按极限规则
Another way to verify that
n^0.1 = big omega(log^10(n))
by using the limit rule?The limit rule is:
For this problem:
That gives us the limit:
Using
L'Hospital's
rule on the limit 10 times we get:Since the n term is only in the numerator, the limit approaches infinity.
By the limit rule