News for hackers. Stuff that matters.
Re:How to Pass a Programming Interview by davorb on Tuesday March 08, 2016 @02:19PM (#11247747)
There are a lot of situations where a "worse" algorithm will be significantly faster that another algorithm that's faster in theory, due to memory locality. In practice, it is very hard to know beforehand what parts of your program will scale and what parts won't.
Re:How to Pass a Programming Interview by aidenn0 on Tuesday March 08, 2016 @11:04PM (#11250839)
This is categorically untrue if you are talking about large numbers and asymptotic complexity. It is true that algorithms with a constant factor larger number of operations may have such properties, but O(n) will always beat O(n^2) eventually, and in nearly all real-world cases at a fairly small n (1000 L1 cache accesses is slower than 1 memory access so n=1000 will be enough to counter any locality issues).