Hacker News new | ask | show | jobs
by chrisseaton 2238 days ago
> This means is a magnitude faster than the previous one!

Is this right? It's a quadratic not an order of magnitude difference isn't it? And can you be an order of magnitude faster in an O notation expression anyway? Isn't an order of magnitude a coefficient? Don't we drop coefficients in O notation?

3 comments

It's definitely wrong. A lot of people use "order of magnitude" to just mean "a lot".

I always use the precise meaning. It might be better for me to say "factor of ten" rather than "order of magnitude" if other people don't always use the precise meaning.

It's not wrong! For some value of N it is an order of magnitude faster. It's just a bit misleading.
For another value of N it's three orders of magnitude faster.

In the example case where s[0] == s[1], it might be an order of magnitude slower, if there's much object initialization for the lookup table.

> Is this right?

It's not right, indeed