News for hackers. Stuff that matters.
Re:Most common phone interview question at Google by chrisseaton on Saturday May 02, 2020 @02:54PM (#23054010)
> 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?

Re:Most common phone interview question at Google by asdginioubnou on Saturday May 02, 2020 @03:07PM (#23054088)
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.

Re:Most common phone interview question at Google by fancyfredbot on Saturday May 02, 2020 @03:06PM (#23054086)
It's not wrong! For some value of N it is an order of magnitude faster. It's just a bit misleading.
Re:Most common phone interview question at Google by eesmith on Saturday May 02, 2020 @03:12PM (#23054131)
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.

Re:Most common phone interview question at Google by stellalo on Saturday May 02, 2020 @03:05PM (#23054079)
> Is this right?

It's not right, indeed