3 ms·
It looks like you intended your first snippet to end with `return result` not `return i`, right? Mixing real-machine finitude with big-O theory often gives une
by pjungwir 4y ago
It looks like you intended your first snippet to end with `return result` not `return i`, right?
Mixing real-machine finitude with big-O theory often gives unexpected or unhelpful results. Once in an interview I argued that since hash tables have a finite number of buckets, at large enough scale they really have O(n) worse-case performance. That didn't go over very well. :-)