asymptotic tight bound for quadratic functions

后端 未结 6 709
-上瘾入骨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

    The idea is to (for big enough n) "trap" the function of interest between two "pure" growth functions (that have only a single constant of proportionality). In this figure two quadratic functions (drawn in red and blue) are trapped between two pure growth functions (drawn in black), and the minimum possible value of n0 in each case is indicated.

    enter image description here

    So once you've picked your values of c1 and c2, you can find the value of n0 by intersecting your function with the two pure growth functions and taking the rightmost intersection.

    But you don't care about the getting smallest possible value for n0 — we're doing asymptotics here, so any big enough value will do — so you can use approximations to get an upper bound on it.

    See davin's answer for how to get the upper bound for n0 into the form given in CLRS.

提交回复
热议问题