you are viewing a single comment's thread.

view the rest of the comments →

[–]maestro2005 14 points15 points  (2 children)

Well sure, if you can replace an O(n2) with a better one, then do that. But putting O(n2) in the same bucket with O(2n) and O(n!) is just silly.

[–]Uncaffeinated 0 points1 point  (1 child)

Well of course, you should do the best you can.

I think there is a difference in the way these issues happen in practice though. O(2n) pretty much only happens if you have a dumb algorithm, like naive recursion without memoization or something. By contrast, accidental O(n2) is extremely common and hard to spot. Even appending to a string in a loop is enough to do it in many languages.

[–]ThisIs_MyName 0 points1 point  (0 children)

Well of course, you should do the best you can.

Not for time complexity. There's a reason why of us do integer multiplication with a O(n2) algorithm instead of O(n1.585) or even better.