Syntactic Confectionery Delight  
PerlMonks 
Re: An informal introduction to O(N) notationby fruiture (Curate) 
on Jan 18, 2003 at 12:09 UTC ( #227954=note: print w/replies, xml )  Need Help?? 
I think it's usefull to have a look at a more formal way of saying what the Big O means after having read this informal orientation. In the end, it's not that hard to understand. You can express the complexity of an algorithm as a complete function that includes constants (startup cost) and constant factors (for example if you iterate over a list thrice), based on the assumption that all primitve actions (+,,/,*,assignation,...) cost 1 "step" of time. Let's call this function f(n,m,...) where n,m,... are all the variable factors that influence the problem. How can we now find a function g(n,m,...) so that O(g(n,m,...)) = f(n,m,...)? Simple
If you think about this relation it's clear that you can forget all constant factors or constants in your program, because a large enough c will always suffice to make c*g() grow faster. Because O(n^2) = O(n^3) you should always find the smallest g() for which f() = O(g()) is true in order to have a representative function g().
This is the lower bound. And finally Θ marks an average "middle":  http://fruiture.de
In Section
Meditations

