6 ms·
Of course O(n) is not equal to O(n^2). O(n) is a set, and O(n^2) is a different set.
by oskarkv 13y ago
Of course O(n) is not equal to O(n^2). O(n) is a set, and O(n^2) is a different set.
- fmax30 13y agoBig O is a upper bound , what I meant was that if a piece of code has O(n) then it also has O(n^2). With emphasis on the upper bound f(x) = O(g(x)) if f(x) <= cg(x). so my point is if f(N) = O(N) then f(N) is also equal to O(N^2) as f(N) <= CN^2 .