good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I think O() analysis definitely has its uses. It's good for
determining "all else being equal, which algorithm will be
faster?"
It doesn't say anything about implementations. I'm
pretty sure I could write a poor implementation of an
O(n log n) algorithm
that runs slower than a good implementation of an O(n^2)
algorithm (for sufficiently small datasets. How small?
Small enough so the O(n log n) implementation is slower :)
But in general, the O(n log n) solution will
be faster, as your
data set increases in size, and as you tweak the
"all else" in your implementation to
get it as close to "equal" as possible.
I wasn't a huge fan of O() notation in college either, once we started analyzing the more complicated algorithms. Not because it was inaccurate, but because it was difficult, and "no one uses those algorithms anyway." However, now I'm glad I did it, because after doing all the hard analysis, the easy analysis which I do use regularly (though not explicitly) comes intuitively. Alan
In reply to RE: Sorting a list of IP addresses (aka Why I hate Big O)
by ferrency
|
|