asymptotic tight bound for quadratic functions

后端 未结 6 710
-上瘾入骨i
-上瘾入骨i 2021-01-31 11:41

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

f(n) = an2 + bn

6条回答
  •  庸人自扰
    2021-01-31 12:22

    well its easy 1.c1<=a + b/n + c/n^2 Now here a is >0 while b,c are either positive or negative Now we must choose value of n such that b/n + c/n^2 never exceeds a in RHS of above eqution cause else it will become negative and so will c1. but by definition c1 is a positive constant

    So we want to make sure a>b/n+c/n^2

    if we choose n=2*max(|b|/a, sqrt(|c|/a) ) we will get b/n + c/n^2 as an expression whose value is less than a/2+a/4.

    thus a+b/n+c/n^2 will have maximum value as a+a/2+a/4 and minimum value as a-(a/2+a/4) which is nothing but values of c2 and c1.

    c1=a-a/2-a/4= a/4 c2=a+a/2+a/4= 7a/4

    This concept can be extended to any values for any polynomial..

    cheers!!!

提交回复
热议问题