algorithm - What is actually mean't by the big-O graph -


there lot of explanation big-0, i'm confused on part.

acoording definition of big-o in function

f (n) ≤ c ·g(n), n ≥ n0  “ f (n) big-oh of g(n).” 

but description of function in terms of big o notation provides upper bound on growth rate of function.

so e.g here 34 upper bound set { 5, 10, 34 }

enter image description here

so if in graph how f(n) o(g(n)) because if upper bound of g(n) function it's value different mentioned here n>=n0 ..

beyond n0, f(n) not grow faster g(n). f(n)'s rate of growth function of n @ g(n).

g(n)'s rate of growth said upper-bound of f(n)'s rate of growth of f(n) big-o of g(n).

the worst case rate of growth of f(n) @ g(n) since f(n) big-o of g(n).

this knowing how big f(n) can grow relative known function.

for example, if f(n) = n^2, , g(n) n^3, trivially f(n) big-o of g(n) since n^2 never grow faster n^3.

"c" used mathematical proofs - it's linear scaling variable. can't go around , claim big-o of else. if choose n0 , c given g(n), , equation holds

f(n) ≤ c ·g(n), n ≥ n0

then can show f(n) big-o of g(n).

example:

f(n) = n^2;
g(n) = n^3;

we can choose n0 = 1, , c = 1 such that

f(n) ≤ 1 ·g(n), n ≥ 1

which becomes

n^2 ≤ 1 ·n^3, n ≥ 1

which holds, f(n) proven big-o of g(n).

proofs can more complicated, instance this, gist of it.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -