Re:How to Rock an Algorithms Interview
by prodigal_erik on Monday September 26, 2011 @06:16PM
(#3040963)
The thing is, it's very easy to end up using a bad algorithm without noticing. If you're doing a linear search over a collection of n elements, fine, but if you end up having to do it n-ish times, suddenly you're up to O(n^2), and if n is ever a few million in reality, your app will enter a loop that's practically infinite. Meanwhile, sorting them would be O(n log2 n) and intersecting two sorted lists is O(n), and n hash table searches is only O(n) if you have enough memory to avoid collisions.
[ Parent
| on HN ]
This algorithm fetish is just stupid. If a function / program isn't slow then it doesn't matter and if it's slow the dev will notice. I mean, come on -- is the dev not going to notice a practically infinite loop?
It wouldn't be slow on "reasonable" testing datasets.
Do you time your app at various loads (including well beyond expectations), graph the performance and look for non-linear increases?