简体   繁体   English

证明g(n)为o(f(n)),则f(n)+ g(n)为Theta(f(n))

[英]Proving if g(n) is o(f(n)), then f(n) + g(n) is Theta(f(n))

So I'm struggling with proving (or disproving) the above question. 因此,我正在努力证明(或证明)上述问题。 I feel like it is true, but I'm not sure how to show it. 我觉得这是真的,但是我不确定如何显示它。

Again, the question is if g(n) is o(f(n)), then f(n) + g(n) is Theta(f(n)) 同样,问题是如果g(n)为o(f(n)),则f(n)+ g(n)为Theta(f(n))

Note, that is a little-o , not a big-o!!! 注意,那是一个小o不是大o !!!

So far, I've managed to (easily) show that: 到目前为止,我已经成功地(轻松地)证明了:

g(n) = o(f(n)) -> g(n) < c*f(n) g(n)= o(f(n)) -> g(n)<c * f(n)

Then g(n) + f(n) < (c+1)*f(n) -> (g(n) + f(n)) = O (f(n)) 然后g(n)+ f(n)<(c + 1)* f(n) -> (g(n)+ f(n))= O (f(n))

However, for showing Big Omega, I'm not sure what to do there. 但是,对于显示Big Omega,我不确定该怎么做。

Am I going about this right? 我要这样做吗?

EDIT: Everyone provided great help, but I could only mark one. 编辑:每个人都提供了很大的帮助,但我只能标记一个。 THANK YOU. 谢谢。

One option would be to take the limit of (f(n) + g(n)) / f(n) as n tends toward infinity. 一种选择是取(f(n)+ g(n))/ f(n)的极限,因为n趋于无穷大。 If this converges to a finite, nonzero value, then f(n) + g(n) = Θ(f(n)). 如果这收敛到一个有限的非零值,则f(n)+ g(n)=Θ(f(n))。

Assuming that f(n) is nonzero for sufficiently large n, the above ratio, in the limit, is 假设对于足够大的n,f(n)不为零,则上述比率在极限范围内为

(f(n) + g(n)) / f(n) (f(n)+ g(n))/ f(n)

= f(n) / f(n) + g(n) / f(n) = f(n)/ f(n)+ g(n)/ f(n)

= 1 + g(n) / f(n). = 1 + g(n)/ f(n)。

Therefore, taking the limit as n goes to infinity, the above expression converges to 1 because the ratio goes to zero (this is what it means for g(n) to be o(f(n)). 因此,当极限为n到无穷大时,由于该比率变为零(因此g(n)为o(f(n)),因此上述表达式收敛为1。

So far so good. 到现在为止还挺好。

For the next step, recall that in the best case, 0 <= g(n) ; 对于下一步,请记住最好的情况是0 <= g(n) ; this should get you a lower bound on g(n) + f(n) . 这应该给你g(n) + f(n)的下界。

Before we begin, lets first state what little-o and Big-Theta notations means: 在开始之前,让我们首先说明little-o和Big-Theta表示法的含义:

Little-o notation 小o表示法

Formally, that g(n) = o(f(n)) (or g(n) ∈ o(f(n)) ) holds for sufficiently large n means that for every positive constant ε there exists a constant N such that 形式上, g(n) = o(f(n)) (或g(n) ∈ o(f(n)) )对于足够大的n成立,意味着对于每个正常数ε都有一个常数N使得

 |g(n)| ≤ ε*|f(n)|, for all n > N (+) 

From https://en.wikipedia.org/wiki/Big_O_notation#Little-o_notation . 来自https://en.wikipedia.org/wiki/Big_O_notation#Little-o_notation

Big-Θ notation 大Θ符号

h(n) = Θ(f(n)) means there exists positive constants k_1 , k_2 and N , such that k_1 · |f(n)| h(n) = Θ(f(n))表示存在正常数k_1k_2N ,因此k_1 · |f(n)| and k_2 · |f(n)| k_2 · |f(n)| is an upper bound and lower bound on on |h(n)| |h(n)|的上限和下限 , respectively, for n > N , ie 分别对于n > N ,即

 k_1 · |f(n)| ≤ |h(n)| ≤ k_2 · |f(n)|, for all n > N (++) 

From https://www.khanacademy.org/computing/computer-science/algorithms/asymptotic-notation/a/big-big-theta-notation . 来自https://www.khanacademy.org/computing/computer-science/algorithms/asymptotic-notation/a/big-big-theta-notation


Given: g(n) ∈ o(f(n)) 给定: g(n) ∈ o(f(n))

Hence, in our case, for every ε>0 we can find some constant N such that (+) , for our functions g(n) and f(n) . 因此,在我们的情况下,对于每个ε>0 ,对于函数g(n)f(n) ,我们可以找到一些常数N使得(+) f(n) Hence, for n>N , we have 因此,对于n>N ,我们有

|g(n)| ≤ ε*|f(n)|, for some ε>0, for all n>N

Choose a constant ε < 1 (recall, the above holds for all ε > 0), 
with accompanied constant N. 
Then the following holds for all n>N

    ε(|g(n)| + |f(n)|) ≤ 2|f(n)| ≤ 2(|g(n)| + |f(n)|) ≤ 4*|f(n)|    (*)

Stripping away the left-most inequality in (*) and dividing by 2, we have: 去除(*)最左边的不等式并除以2,我们得到:

|f(n)| ≤ |g(n)| + |f(n)| ≤ 2*|f(n)|, n>N                            (**) 

We see that this is the very definition Big-Θ notation, as presented in (++) , with constants k_1 = 1 , k_2 = 2 and h(n) = g(n)+f(n) . 我们看到,这是定义非常清晰的Big-Θ符号,如(++) ,常数k_1 = 1k_2 = 2h(n) = g(n)+f(n) Hence 因此

(**) => g(n) + f(n) is in Θ(f(n))

Ans we have shown that g(n) ∈ o(f(n)) implies (g(n) + f(n)) ∈ Θ(f(n)) . Ans我们已经证明g(n) ∈ o(f(n))意味着(g(n) + f(n)) ∈ Θ(f(n))

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

相关问题 是否有可能证明f(n)+ g(n)= theta(n ^ 2)for f(n)= theta(n ^ 2)&g(n)= O(n ^ 2) - Is it possible to prove that f(n) + g(n) = theta(n^2) for f(n) = theta(n^2) & g(n) = O(n^2) 证明复杂性证明的顺序如果 f(n) 是 Ω(n∗g(n)),那么 f(n) 不是 O(g(n)) - Proving Order of complexity proofs if f(n) is Ω(n∗g(n)), then f(n) is not O(g(n)) f(n) = o(g(n)) ve f(n) ≠ Ɵ(g(n)) - f(n) = o(g(n)) ve f(n) ≠ Ɵ(g(n)) 如果 f(n) = O(n) 且 g(n) = O(n),证明 f(g(n)) = O(n) - If f(n) = O(n) and g(n) = O(n), prove f(g(n)) = O(n) 渐近。 如果 f(n) = theta(g(n)) 并且 g(n) = theta(h(n)),那么为什么 h(n) = theta(f(n)) - Asymptotic. If f(n) = theta(g(n)) and g(n) = theta(h(n)), then why h(n) = theta(f(n)) 鉴于 f(n) = 10000000n 和 g(n) = n^2。 为什么 f(n) 是 O(g(n))? - Given that f(n) = 10000000n and g(n) = n^2. Why f(n) is O(g(n))? 证明f(n)+ d(n)= O(g(n)+ h(n)) - Prove f(n) + d(n)= O(g(n)+ h(n)) "证明 f(n) = Θ(g(n)) 当且仅当 g(n) = Θ(f(n))" - Prove that f(n) = Θ(g(n)) iff g(n) = Θ(f(n)) 如果,g,h是函数使得f(n)= O(g(n))并且g(n)= O(h(n))证明f(n)= O(h(n)) - If, g , h are functions such that f(n) = O(g(n)) and g(n) = O(h(n)) prove f(n) = O(h(n)) 如果 f(n) = O(g(n)),log(f(n)) = O(log(g(n))? - If f(n) = O(g(n)), is log(f(n)) = O(log(g(n))?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM