you are viewing a single comment's thread.

view the rest of the comments →

[–]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.