本文介绍了渐近紧开往二次函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CLRS(算法导论的由Cormen,Leiserson,维斯特和斯坦的) ,对于函数

In CLRS (Introduction to Algorithms by Cormen, Leiserson, Rivest, and Stein), for a function

F 的( N )=的的 + BN + C

他们说

假设我们把常量的 C 的 1 = 的/ 4的 C 的 = 2·马克斯(| B 的| / 的,√(| C 的| /的的)。)
  然后,0≤ C 的 1 的 N 的≤的 + BN + C 的≤的 C 的的 N 的所有的 N 的≥的 N 的 0 。
  因此, F 的( N )是Θ( N 的)。

但他们没有说明如何将这些常量的值来了?
我试图证明这一点,但不能。
请告诉我这些常量是怎么来?

But they didn't specify how values of these constants came ?
I tried to prove it but couldn't.
Please tell me how these constants came ?

推荐答案

有没有什么特别的那些特定的常量(除了一个事实,即在一定的 N 值的情况下他们将满足的θ-岬 F )。没有魔法。如果你能找到其他积极的常数,从而保持了这种关系,这只是为有效(其实, C1 可以是任何 0℃; K< 1 )。虽然因为它们的存在,让我们分析 C1

There's nothing special about those particular constants (other than the fact that in context of a certain n value they will satisfy the theta-ness of f). No magic. If you can find other positive constants whereby the relation holds that is just as valid (in fact, c1 can be ka for any 0<k<1). Although since they're there, let's analyse c1:

我们需要它来满足以下不等式:

We need it to satisfy the following inequality:

c1*n^2 <= an^2 + bn + c

让我们自己的价值: C1 = A / 4 。对于什么 N ,才能保证不等式成立?我们可以解决:

Let's take their value: c1 = a/4. For what n can we guarantee that the inequality holds? We could solve:

a/4*n^2 <= an^2 + bn + c
<==> 0 <= 3a/4*n^2 + bn + c

在二次在有解决方案/(3A / 2),只有积极的,其中( - - B +的sqrt(B ^ 2-3ac))是任何兴趣,因为我们有一个积极的领导系数多项式,所以我们要求 N'GT; 2 *(开方(B ^ 2-3ac) - B)/ 3A 这是明确的假设 B ^ 2 - = 3AC ​​(和如果不是,则二次是正定的,这甚至更好,因为它的> = 0到处和不等式成立对于所有的n)。我要指出,这是一个有效的解决方案,但直到我们在这本书的重presentation到达我们会做更多的工作。

The quadratic has solutions at (-b +- sqrt(b^2-3ac)) / (3a/2), only the positive of which is of any interest since we have a positive leading coefficient polynomial, so we require n > 2 * (sqrt(b^2-3ac) - b) / 3a which is well defined assuming b^2 >= 3ac (and if not, then the quadratic is positive definite, which is even better, since its >=0 everywhere and the inequality holds for all n). I should point out that this is a valid solution, although we'll do a bit more work until we arrive at the book's representation.

我们可以分裂我们的分析到2例。首先,让我们假设 | B | / A&GT; =开方(| C | / A)。因此,我们可以绑定从上面的的sqrt(...)的内部与 4B ^ 2 ,并要求 N'GT; 2/3 * [开方(4B ^ 2)-b]​​ / A 可通过 2/3 * 3被上界| B | / A = 2 | B | / A

We can split our analysis into 2 cases. First, let's assume |b|/a >= sqrt(|c|/a). So we can bound from above the inside of the sqrt(...) with 4b^2, and require n > 2/3 * [sqrt(4b^2)-b]/a which can be upper bounded by 2/3 * 3|b|/a = 2|b|/a.

第二种情况,假设 | B | / A&LT;开方(| C | / A)。因此,我们可以从上面的内部约束的sqrt(...) 4A | C | ,并要求 N'GT; 2/3 * [开方(4A | C |)-b] / A 可通过 2/3 * 3 *开方被上界(A | C |)/ A = 2sqrt(| C | / A)。

Second case, let's assume |b|/a < sqrt(|c|/a). So we can bound from above the inside of the sqrt(...) with 4a|c|, and require n > 2/3 * [sqrt(4a|c|)-b]/a which can be upper bounded by 2/3 * 3*sqrt(a|c|)/a = 2sqrt(|c|/a).

因此​​,在每一种情况下,我们看到,当我们采取 MAX(| B | / A,开方(| C | / A))我们的不等式成立时, N'GT; 2 *最大

So in each case we see that when we take max(|b|/a, sqrt(|c|/a)) our inequality holds when n > 2 * max

同样,对于 C2

这篇关于渐近紧开往二次函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 13:49