Can an O(n) algorithm ever exceed O(n^2) in terms of computation time?
Asymptotic complexity (which is what both big-O and big-Theta represent) completely ignores the constant factors involved – it’s only intended to give an indication of how running time will change as the size of the input gets larger. So it’s certainly possible that an Θ(n) algorithm can take longer than an Θ(n2) one for some … Read more