O(no) You Didn’t

54 points by knl


n3t

A good reminder that constants disappear in the big O notation. There is even a name for algorithms that – despite having lower asymptotic complexity – are never faster in our real-world: Galactic algorithms.

Sometimes the difference is negligible. I’ve recently implemented two algorithms for a problem. One was O(n³) and the other O(n). When benchmarked on expected input (strings of length between 1 and 100 characters), the linear solution was only teeny tiny bit faster (and not even always).