3 ms·
An O claim can always be pessimistic. A linear time algorithm in N is not only O(N) but also O(N*N) an O(2^N): it is at least as good as all of these. If we are
by kazinator 12y ago
An O claim can always be pessimistic. A linear time algorithm in N is not only O(N) but also O(N*N) an O(2^N): it is at least as good as all of these. If we are sure that the algorithm is faster or slower than N, then can say Theta(N), the tight bound.
http://stackoverflow.com/questions/471199/what-is-the-difference-between-%CE%98n-and-on http://stackoverflow.com/questions/471199/what-is-the-differ...
(Often, we are sure but we still use O.)
- dllthomas 12y agoA start-up I applied for once asked me to take a test, and one of the problems was "Implement a sorting algorithm that is not O(n^2)." I thought about snarkily adding extra walks through the data, but decided instead to explain the problem with the question and answer the question they were trying to ask.