in reply to An informal introduction to O(N) notation
One thing that you didn't actualy give is a defintion for "order of growth", which would explain why O(1)==O(2), and why O(2N+3) == O(N).
I'd try to give a defintion, but I'd most likely get it wrong... I almost quoted Knuth here, but then I realized that I didn't understand what he meant. (For those that care, see pg 107 of vol 1, 3rd ed, of TAoCP.)
Update: Everything below this point. (I kept reading that section, and didn't want to "waste" another node.)
In purticular, note that O(n) gives an /upper/ bound on the order of growth of a purticular algo, and is by no means exact. There's also Ω(N), which gives the lower-bound.
Additionaly, saying that one algo is O(1), whereas another is O(2^N) does mean that, for a large enough dataset, the first algo will be faster then the second. It does /not/ mean that it will be for any reasonable dataset. For example, if the first algo takes 1 year to complete, but the second takes 2^N nanoseconds, it will take... well, a huge dataset before the first becomes faster.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: An informal introduction to O(N) notation
by dws (Chancellor) on Jan 18, 2003 at 05:15 UTC | |
Re: An informal introduction to O(N) notation
by Abigail-II (Bishop) on Jan 18, 2003 at 12:37 UTC | |
by theorbtwo (Prior) on Jan 18, 2003 at 21:40 UTC |