3 ms·
Of course, for low values of N the constants dropped from the big-O notation start to matter. For very small values of N and a random-access input, even an O(N^
by magicalhippo 8y ago
Of course, for low values of N the constants dropped from the big-O notation start to matter. For very small values of N and a random-access input, even an O(N^2) approach may be optimal (for each input element, check for equality against previous elements of the input, output if no hit).
- ww520 8y agoWell, when N is small, any complexity analysis is moot.
- magicalhippo 8y agoYes, but it's easy to forget and still apply it blindly in regimes where it's not really applicable anymore.