Best possible order



If we’re talking about which one would be better, O(n) will always be the best, that’s a no-brainer. However, managing to get an O(n) algorithm is not always feasible.

I initially though the best we could do was an O(n*log n + n), but reading the topics here and looking at the rest of the lecture I saw that it is possible to achieve an O(n) in this case.

I guess I’m just not cut for this programming thing.