4 ms·
> true obviously Well, it doesn't seem that obvious, at least not to everyone, because several times I've seen people rewrite things to make it O(1) when it wa
by arp242 1y ago
> true obviously
Well, it doesn't seem that obvious, at least not to everyone, because several times I've seen people rewrite things to make it O(1) when it was actually slower for the vast majority of cases (or even all cases).
- branko_d 1y agoEven if it's slower for the vast majority of cases, but there are rare cases where the computer would otherwise freeze, that's still a win.
- arp242 1y agoYour computer will not freeze if your input is small enough no matter what big-O says. In many cases it's guaranteed to be small or small-ish.
- branko_d 1y ago> In many cases it's guaranteed to be small or small-ish. And in many cases it's assumed to be small, but not guaranteed. That's where the trouble lies. A classic example is Windows using a quadratic algorithm for arranging desktop icons that caused severe performance issues when users had many icons on their desktop. https://github.com/microsoft/Windows-Dev-Performance/issues/80 https://github.com/microsoft/Windows-Dev-Performance/issues/...